gitlab/danger/product_intelligence/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
1.1 KiB
Ruby

# frozen_string_literal: true
# rubocop:disable Style/SignalException
CHANGED_FILES_MESSAGE = <<~MSG
For the following files, a review from the [Data team and Product Intelligence team](https://gitlab.com/groups/gitlab-org/growth/product-intelligence/engineers/-/group_members?with_inherited_permissions=exclude) is recommended
Please check the ~"product intelligence" [guide](https://docs.gitlab.com/ee/development/usage_ping.html).
For MR review guidelines, see the [Service Ping review guidelines](https://docs.gitlab.com/ee/development/usage_ping/review_guidelines.html) or the [Snowplow review guidelines](https://docs.gitlab.com/ee/development/snowplow/review_guidelines.html).
%<changed_files>s
MSG
# exit if not matching files or if no product intelligence labels
product_intelligence_paths_to_review = project_helper.changes_by_category[:product_intelligence]
labels_to_add = product_intelligence.missing_labels
return if product_intelligence_paths_to_review.empty? || labels_to_add.empty?
warn format(CHANGED_FILES_MESSAGE, changed_files: helper.markdown_list(product_intelligence_paths_to_review))
project_helper.labels_to_add.concat(labels_to_add)