2020-10-13 08:08:41 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
TEMPLATE_MESSAGE = <<~MSG
|
|
|
|
This merge request requires a CI/CD Template review. To make sure these
|
|
|
|
changes are reviewed, take the following steps:
|
|
|
|
|
|
|
|
1. Ensure the merge request has the ~"ci::templates" label.
|
|
|
|
If the merge request modifies CI/CD Template files, Danger will do this for you.
|
|
|
|
1. Prepare your MR for a CI/CD Template review according to the
|
|
|
|
[template development guide](https://docs.gitlab.com/ee/development/cicd/templates.html).
|
|
|
|
1. Assign and `@` mention the CI/CD Template reviewer suggested by Reviewer Roulette.
|
|
|
|
MSG
|
|
|
|
|
|
|
|
TEMPLATE_FILES_MESSAGE = <<~MSG
|
|
|
|
The following files require a review from the CI/CD Templates maintainers:
|
|
|
|
MSG
|
|
|
|
|
2021-03-12 07:09:33 -05:00
|
|
|
return unless helper.ci?
|
2020-10-13 08:08:41 -04:00
|
|
|
|
2021-03-12 07:09:33 -05:00
|
|
|
template_paths_to_review = project_helper.changes_by_category[:ci_template]
|
2020-10-13 08:08:41 -04:00
|
|
|
|
|
|
|
if gitlab.mr_labels.include?('ci::templates') || template_paths_to_review.any?
|
|
|
|
message 'This merge request adds or changes files that require a ' \
|
|
|
|
'review from the CI/CD Templates maintainers.'
|
|
|
|
|
|
|
|
markdown(TEMPLATE_MESSAGE)
|
|
|
|
markdown(TEMPLATE_FILES_MESSAGE + helper.markdown_list(template_paths_to_review)) if template_paths_to_review.any?
|
|
|
|
end
|