gitlab/danger/specialization_labels/Dangerfile
Rémy Coutable 7c772bebf6
danger: Don't warn for missing labels while adding some
Signed-off-by: Rémy Coutable <remy@rymai.me>
2021-10-27 17:43:31 +02:00

23 lines
566 B
Ruby

# frozen_string_literal: true
return unless helper.ci?
SPECIALIZATIONS = {
database: 'database',
backend: 'backend',
frontend: 'frontend',
docs: 'documentation',
qa: 'QA',
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]
memo << label if label && !gitlab.mr_labels.include?(label)
end
project_helper.labels_to_add.concat(labels_to_add) if labels_to_add.any?