Commit 0320abd9 authored by Ash McKenzie's avatar Ash McKenzie

Merge branch 'danger-should-not-override-type-label' into 'master'

danger: Don't override already-set scoped labels

See merge request gitlab-org/gitlab!73676
parents 0024362d 16024dad
...@@ -15,8 +15,14 @@ SPECIALIZATIONS = { ...@@ -15,8 +15,14 @@ SPECIALIZATIONS = {
labels_to_add = project_helper.changes_by_category.each_with_object([]) do |(category, _changes), memo| labels_to_add = project_helper.changes_by_category.each_with_object([]) do |(category, _changes), memo|
label = SPECIALIZATIONS[category] label = SPECIALIZATIONS[category]
next unless label
next if gitlab.mr_labels.include?(label)
memo << label if label && !gitlab.mr_labels.include?(label) # 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) }
memo << label
end end
project_helper.labels_to_add.concat(labels_to_add) if labels_to_add.any? project_helper.labels_to_add.concat(labels_to_add) if labels_to_add.any?
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment