Commit 16024dad authored by Rémy Coutable's avatar Rémy Coutable

danger: Don't override already-set scoped labels

Signed-off-by: default avatarRémy Coutable <remy@rymai.me>
parent 7304f86c
......@@ -15,8 +15,14 @@ SPECIALIZATIONS = {
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)
# 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
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