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 /danger/specialization_labels/Dangerfile | |
parent | 27909cef6c4170ed9205afa7426b8d3de47cbb0c (diff) | |
download | gitlab-ce-14.5.0-rc42.tar.gz |
Add latest changes from gitlab-org/gitlab@14-5-stable-eev14.5.0-rc42
Diffstat (limited to 'danger/specialization_labels/Dangerfile')
-rw-r--r-- | danger/specialization_labels/Dangerfile | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/danger/specialization_labels/Dangerfile b/danger/specialization_labels/Dangerfile index e86d66f5fbc..24a759cddc8 100644 --- a/danger/specialization_labels/Dangerfile +++ b/danger/specialization_labels/Dangerfile @@ -6,21 +6,24 @@ SPECIALIZATIONS = { database: 'database', backend: 'backend', frontend: 'frontend', + ux: 'UX', docs: 'documentation', qa: 'QA', - tooling: 'tooling', + tooling: 'type::tooling', ci_template: 'ci::templates', feature_flag: 'feature flag' }.freeze labels_to_add = project_helper.changes_by_category.each_with_object([]) do |(category, _changes), memo| label = SPECIALIZATIONS[category] + next unless label + next if gitlab.mr_labels.include?(label) - memo << label if label && !gitlab.mr_labels.include?(label) -end + # Don't override already-set scoped labels. + label_scope = label.split('::')[0...-1].join('::') + next if !label_scope.empty? && gitlab.mr_labels.any? { |mr_label| mr_label.start_with?(label_scope) } -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(',')) + memo << label end + +project_helper.labels_to_add.concat(labels_to_add) if labels_to_add.any? |