diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-18 13:16:36 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-18 13:16:36 +0000 |
commit | 311b0269b4eb9839fa63f80c8d7a58f32b8138a0 (patch) | |
tree | 07e7870bca8aed6d61fdcc810731c50d2c40af47 /Dangerfile | |
parent | 27909cef6c4170ed9205afa7426b8d3de47cbb0c (diff) | |
download | gitlab-ce-311b0269b4eb9839fa63f80c8d7a58f32b8138a0.tar.gz |
Add latest changes from gitlab-org/gitlab@14-5-stable-eev14.5.0-rc42
Diffstat (limited to 'Dangerfile')
-rw-r--r-- | Dangerfile | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/Dangerfile b/Dangerfile index 37a45674e16..212097f6a68 100644 --- a/Dangerfile +++ b/Dangerfile @@ -17,6 +17,21 @@ end anything_to_post = status_report.values.any? { |data| data.any? } -if helper.ci? && anything_to_post +return unless helper.ci? + +def post_labels + gitlab.api.update_merge_request(gitlab.mr_json['project_id'], + gitlab.mr_json['iid'], + add_labels: project_helper.labels_to_add.join(',')) +rescue Gitlab::Error::Forbidden + labels = project_helper.labels_to_add.map { |label| %Q(~"#{label}") } + warn("This Merge Request needs to be labelled with #{labels.join(' ')}. Please request a reviewer or maintainer to add them.") +end + +if project_helper.labels_to_add.any? + post_labels +end + +if anything_to_post markdown("**If needed, you can retry the [`danger-review` job](#{ENV['CI_JOB_URL']}) that generated this comment.**") end |