debian-mirror-gitlab/danger/specialization_labels/Dangerfile

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

29 lines
733 B
Ruby
Raw Normal View History

2020-11-24 15:15:51 +05:30
# frozen_string_literal: true
2021-04-17 20:07:23 +05:30
return unless helper.ci?
2020-11-24 15:15:51 +05:30
SPECIALIZATIONS = {
database: 'database',
backend: 'backend',
frontend: 'frontend',
2021-12-11 22:18:48 +05:30
ux: 'UX',
2020-11-24 15:15:51 +05:30
docs: 'documentation',
qa: 'QA',
2021-09-30 23:02:18 +05:30
ci_template: 'ci::templates',
feature_flag: 'feature flag'
2020-11-24 15:15:51 +05:30
}.freeze
2022-01-26 12:08:38 +05:30
labels_to_add = helper.changes_by_category.each_with_object([]) do |(category, _changes), memo|
2020-11-24 15:15:51 +05:30
label = SPECIALIZATIONS[category]
2021-12-11 22:18:48 +05:30
next unless label
2022-06-21 17:19:12 +05:30
next if helper.mr_labels.include?(label)
2020-11-24 15:15:51 +05:30
2021-12-11 22:18:48 +05:30
# Don't override already-set scoped labels.
label_scope = label.split('::')[0...-1].join('::')
2022-06-21 17:19:12 +05:30
next if !label_scope.empty? && helper.has_scoped_label_with_scope?(label_scope)
2020-11-24 15:15:51 +05:30
2021-12-11 22:18:48 +05:30
memo << label
2020-11-24 15:15:51 +05:30
end
2021-12-11 22:18:48 +05:30
2022-05-07 20:08:51 +05:30
helper.labels_to_add.concat(labels_to_add) if labels_to_add.any?