summaryrefslogtreecommitdiff
path: root/danger/ci_templates/Dangerfile
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-10-21 07:08:36 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-10-21 07:08:36 +0000
commit48aff82709769b098321c738f3444b9bdaa694c6 (patch)
treee00c7c43e2d9b603a5a6af576b1685e400410dee /danger/ci_templates/Dangerfile
parent879f5329ee916a948223f8f43d77fba4da6cd028 (diff)
downloadgitlab-ce-13.5.0-rc42.tar.gz
Add latest changes from gitlab-org/gitlab@13-5-stable-eev13.5.0-rc42
Diffstat (limited to 'danger/ci_templates/Dangerfile')
-rw-r--r--danger/ci_templates/Dangerfile30
1 files changed, 30 insertions, 0 deletions
diff --git a/danger/ci_templates/Dangerfile b/danger/ci_templates/Dangerfile
new file mode 100644
index 00000000000..34b4bbff7a5
--- /dev/null
+++ b/danger/ci_templates/Dangerfile
@@ -0,0 +1,30 @@
+# frozen_string_literal: true
+
+gitlab_danger = GitlabDanger.new(helper.gitlab_helper)
+
+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
+
+return unless gitlab_danger.ci?
+
+template_paths_to_review = helper.changes_by_category[:ci_template]
+
+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