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
|
|
|
|
|
|
|
|
|
|
|
%<changed_files>s
|
|
|
|
|
|
|
|
MSG
|
|
|
|
|
2021-03-11 19:13:27 +05:30
|
|
|
UPDATE_DICTIONARY_MESSAGE = <<~MSG
|
2021-04-17 20:07:23 +05:30
|
|
|
When adding, changing, or updating metrics, please update the [Metrics Dictionary](https://docs.gitlab.com/ee/development/usage_ping/dictionary.html)
|
2021-03-11 19:13:27 +05:30
|
|
|
|
|
|
|
```shell
|
|
|
|
bundle exec rake gitlab:usage_data:generate_metrics_dictionary
|
|
|
|
```
|
|
|
|
MSG
|
|
|
|
|
2021-09-04 01:27:46 +05:30
|
|
|
# exit if not matching files
|
|
|
|
matching_changed_files = product_intelligence.matching_changed_files
|
|
|
|
return unless matching_changed_files.any?
|
2021-03-11 19:13:27 +05:30
|
|
|
|
2021-09-04 01:27:46 +05:30
|
|
|
warn format(CHANGED_FILES_MESSAGE, changed_files: helper.markdown_list(matching_changed_files))
|
|
|
|
fail format(UPDATE_DICTIONARY_MESSAGE) if product_intelligence.need_dictionary_changes?
|
2021-01-03 14:25:43 +05:30
|
|
|
|
2021-09-04 01:27:46 +05:30
|
|
|
labels = product_intelligence.missing_labels
|
|
|
|
return unless labels.any?
|
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)
|