summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWinnie Hellmann <winnie@gitlab.com>2019-02-20 20:01:01 +0100
committerWinnie Hellmann <winnie@gitlab.com>2019-02-20 20:01:01 +0100
commitc7beb4bd459d7646ae04faac1f591e9276b1ed36 (patch)
tree01eaacfc041a1327bcd13498f54a22471ea1f230
parentc01791446eb47e0acc9cbb9f286651661409ee46 (diff)
downloadgitlab-ce-winh-only-frontend-tests.tar.gz
Add Danger rule for frontend brancheswinh-only-frontend-tests
-rw-r--r--danger/frontend_branch/Dangerfile12
1 files changed, 12 insertions, 0 deletions
diff --git a/danger/frontend_branch/Dangerfile b/danger/frontend_branch/Dangerfile
new file mode 100644
index 00000000000..8e6545e539b
--- /dev/null
+++ b/danger/frontend_branch/Dangerfile
@@ -0,0 +1,12 @@
+# frozen_string_literal: true
+
+# rubocop: disable Style/SignalException
+
+return unless ENV['CI_COMMIT_REF_NAME'] =~ /-frontend(-ee)?$/
+
+changed_backend_files = helper.all_changed_files.select do |file|
+ file.strip.match?(/\.rb\z/) && !file.match?(/\A(ee\/)?spec\/(features|javascripts\/fixtures)\//)
+end
+return if changed_backend_files.empty?
+
+fail("Branch ends with -frontend but there are the following non-frontend changes: #{changed_backend_files.join(', ')}")