Sha256: 5618fd8dae14aba01c00ef94f5fdd63c951d1e2ac4791bd9f29c277fc3253920

Contents?: true

Size: 696 Bytes

Versions: 32

Compression:

Stored size: 696 Bytes

Contents

# This rule is the (almost) last one since we want to add all the labels to add at once,
# so we let other rules adding to `helper.labels_to_add` before actually adding them via the API here.

# Don't try to post anything locally.
return unless helper.ci?

def post_labels(labels)
  gitlab.api.update_merge_request(helper.mr_target_project_id,
                                  helper.mr_iid,
                                  add_labels: labels.join(","))
rescue Gitlab::Error::Forbidden
  warn("This Merge Request needs to be labelled with #{helper.labels_list(labels)}. Please request a reviewer or maintainer to add them.")
end

post_labels(helper.labels_to_add) if helper.labels_to_add.any?

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
gitlab-dangerfiles-4.1.0 lib/danger/rules/z_add_labels/Dangerfile
gitlab-dangerfiles-4.0.0 lib/danger/rules/z_add_labels/Dangerfile
gitlab-dangerfiles-3.13.0 lib/danger/rules/z_add_labels/Dangerfile
gitlab-dangerfiles-3.12.0 lib/danger/rules/z_add_labels/Dangerfile
gitlab-dangerfiles-3.11.0 lib/danger/rules/z_add_labels/Dangerfile
gitlab-dangerfiles-3.10.0 lib/danger/rules/z_add_labels/Dangerfile
gitlab-dangerfiles-3.9.0 lib/danger/rules/z_add_labels/Dangerfile
gitlab-dangerfiles-3.8.0 lib/danger/rules/z_add_labels/Dangerfile
gitlab-dangerfiles-3.7.0 lib/danger/rules/z_add_labels/Dangerfile
gitlab-dangerfiles-3.6.7 lib/danger/rules/z_add_labels/Dangerfile
gitlab-dangerfiles-3.6.6 lib/danger/rules/z_add_labels/Dangerfile
gitlab-dangerfiles-3.6.5 lib/danger/rules/z_add_labels/Dangerfile
gitlab-dangerfiles-3.6.4 lib/danger/rules/z_add_labels/Dangerfile
gitlab-dangerfiles-3.6.3 lib/danger/rules/z_add_labels/Dangerfile
gitlab-dangerfiles-3.6.2 lib/danger/rules/z_add_labels/Dangerfile
gitlab-dangerfiles-3.6.1 lib/danger/rules/z_add_labels/Dangerfile
gitlab-dangerfiles-3.6.0 lib/danger/rules/z_add_labels/Dangerfile
gitlab-dangerfiles-3.5.2 lib/danger/rules/z_add_labels/Dangerfile
gitlab-dangerfiles-3.5.1 lib/danger/rules/z_add_labels/Dangerfile
gitlab-dangerfiles-3.5.0 lib/danger/rules/z_add_labels/Dangerfile