debian-mirror-gitlab/danger/product_intelligence/Dangerfile

25 lines
1.2 KiB
Ruby
Raw Normal View History

2021-01-03 14:25:43 +05:30
# frozen_string_literal: true
2021-03-11 19:13:27 +05:30
# rubocop:disable Style/SignalException
2021-01-03 14:25:43 +05:30
2021-03-08 18:12:59 +05:30
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
2021-04-29 21:17:54 +05:30
Please check the ~"product intelligence" [guide](https://docs.gitlab.com/ee/development/usage_ping.html).
2021-01-03 14:25:43 +05:30
2021-11-18 22:05:49 +05:30
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).
2021-01-03 14:25:43 +05:30
%<changed_files>s
MSG
2021-11-18 22:05:49 +05:30
# exit if not matching files or if no product intelligence labels
2021-09-04 01:27:46 +05:30
matching_changed_files = product_intelligence.matching_changed_files
2021-11-18 22:05:49 +05:30
labels = product_intelligence.missing_labels
2021-03-11 19:13:27 +05:30
2021-11-18 22:05:49 +05:30
return if matching_changed_files.empty? || labels.empty?
2021-01-03 14:25:43 +05:30
2021-11-18 22:05:49 +05:30
warn format(CHANGED_FILES_MESSAGE, changed_files: helper.markdown_list(matching_changed_files))
2021-04-17 20:07:23 +05:30
2021-09-04 01:27:46 +05:30
gitlab.api.update_merge_request(gitlab.mr_json['project_id'],
2021-06-08 01:23:25 +05:30
gitlab.mr_json['iid'],
add_labels: labels)