diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-09-19 04:45:44 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-09-19 04:45:44 +0300 |
commit | 85dc423f7090da0a52c73eb66faf22ddb20efff9 (patch) | |
tree | 9160f299afd8c80c038f08e1545be119f5e3f1e1 /danger/specialization_labels | |
parent | 15c2c8c66dbe422588e5411eee7e68f1fa440bb8 (diff) |
Add latest changes from gitlab-org/gitlab@13-4-stable-ee
Diffstat (limited to 'danger/specialization_labels')
-rw-r--r-- | danger/specialization_labels/Dangerfile | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/danger/specialization_labels/Dangerfile b/danger/specialization_labels/Dangerfile new file mode 100644 index 00000000000..919f7313b49 --- /dev/null +++ b/danger/specialization_labels/Dangerfile @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +gitlab_danger = GitlabDanger.new(helper.gitlab_helper) + +return unless gitlab_danger.ci? + +SPECIALIZATIONS = { + database: 'database', + backend: 'backend', + frontend: 'frontend', + docs: 'documentation', + qa: 'QA', + engineering_productivity: 'Engineering Productivity' +}.freeze + +labels_to_add = helper.changes_by_category.each_with_object([]) do |(category, _changes), memo| + label = SPECIALIZATIONS[category] + + memo << label if label && !gitlab.mr_labels.include?(label) +end + +if labels_to_add.any? + gitlab.api.update_merge_request(gitlab.mr_json['project_id'], + gitlab.mr_json['iid'], + add_labels: labels_to_add.join(',')) +end |