summaryrefslogtreecommitdiff
path: root/danger
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2018-07-16 19:23:45 +0200
committerRémy Coutable <remy@rymai.me>2018-07-17 09:43:47 +0200
commit8ce6381f3cc822a919492406455e82af4373c4f4 (patch)
treef8de41b5654e933a0d12416e1128e7593525b8a8 /danger
parent3e573142b7f048b454755ece0f3a66850ef063a4 (diff)
downloadgitlab-ce-8ce6381f3cc822a919492406455e82af4373c4f4.tar.gz
Improve danger/specs/Dangerfile by not requiring new specs if specific labels are appliedmove-danger-to-test-stage
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'danger')
-rw-r--r--danger/specs/Dangerfile14
1 files changed, 10 insertions, 4 deletions
diff --git a/danger/specs/Dangerfile b/danger/specs/Dangerfile
index 934ea0beadb..97188df8785 100644
--- a/danger/specs/Dangerfile
+++ b/danger/specs/Dangerfile
@@ -1,12 +1,18 @@
+NO_SPECS_LABELS = %w[backstage Documentation QA].freeze
NO_NEW_SPEC_MESSAGE = <<~MSG.freeze
You've made some app changes, but didn't add any tests.
That's OK as long as you're refactoring existing code,
-but please consider adding the ~backstage label in that case.
+but please consider adding any of the %<labels>s labels.
MSG
+def presented_no_changelog_labels
+ NO_SPECS_LABELS.map { |label| "~#{label}" }.join(', ')
+end
+
has_app_changes = !git.modified_files.grep(%r{\A(ee/)?(app|lib|db/(geo/)?(post_)?migrate)/}).empty?
-has_spec_changes = !git.modified_files.grep(/spec/).empty?
+has_spec_changes = !git.modified_files.grep(%r{\A(ee/)?spec/}).empty?
+new_specs_needed = (gitlab.mr_labels & NO_SPECS_LABELS).empty?
-if has_app_changes && !has_spec_changes
- warn NO_NEW_SPEC_MESSAGE, sticky: false
+if has_app_changes && !has_spec_changes && new_specs_needed
+ warn format(NO_NEW_SPEC_MESSAGE, labels: presented_no_changelog_labels), sticky: false
end