Welcome to mirror list, hosted at ThFree Co, Russian Federation.

Dangerfile « product_intelligence « danger - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 5469e8a87a5b1031f00cd1a9896526aeb1848537 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# 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).


%<changed_files>s

MSG

UPDATE_DICTIONARY_MESSAGE = <<~MSG
  When adding, changing, or updating metrics, please update the [Metrics Dictionary](https://docs.gitlab.com/ee/development/usage_ping/dictionary.html)

  ```shell
  bundle exec rake gitlab:usage_data:generate_metrics_dictionary
  ```
MSG

# exit if not matching files
matching_changed_files = product_intelligence.matching_changed_files
return unless matching_changed_files.any?

warn format(CHANGED_FILES_MESSAGE, changed_files: helper.markdown_list(matching_changed_files))
fail format(UPDATE_DICTIONARY_MESSAGE) if product_intelligence.need_dictionary_changes?

labels = product_intelligence.missing_labels
return unless labels.any?

gitlab.api.update_merge_request(gitlab.mr_json['project_id'],
                                    gitlab.mr_json['iid'],
                                    add_labels: labels)