summaryrefslogtreecommitdiff
path: root/danger
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-09-16 12:06:26 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-09-16 12:06:26 +0000
commitd2798d607e11e0ebae83ae909404834388733428 (patch)
tree096b7f4d4bdb315d28cdcd4d6db4e80911112e9c /danger
parentd8211a0ed119eada7d292e974a8fc7b0cd982d3c (diff)
downloadgitlab-ce-d2798d607e11e0ebae83ae909404834388733428.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'danger')
-rw-r--r--danger/commit_messages/Dangerfile10
1 files changed, 8 insertions, 2 deletions
diff --git a/danger/commit_messages/Dangerfile b/danger/commit_messages/Dangerfile
index d371ade4887..064b8c94805 100644
--- a/danger/commit_messages/Dangerfile
+++ b/danger/commit_messages/Dangerfile
@@ -37,6 +37,10 @@ class EmojiChecker
end
end
+def gitlab_danger
+ @gitlab_danger ||= GitlabDanger.new(helper.gitlab_helper)
+end
+
def fail_commit(commit, message)
fail("#{commit.sha}: #{message}")
end
@@ -56,6 +60,8 @@ def subject_starts_with_capital?(subject)
end
def ce_upstream?
+ return unless gitlab_danger.ci?
+
gitlab.mr_labels.any? { |label| label == 'CE upstream' }
end
@@ -88,8 +94,8 @@ def lint_commit(commit) # rubocop:disable Metrics/AbcSize
# We ignore revert commits as they are well structured by Git already
return false if commit.message.start_with?('Revert "')
- is_squash = gitlab.mr_json['squash']
- is_wip = gitlab.mr_json['work_in_progress']
+ is_squash = gitlab_danger.ci? ? gitlab.mr_json['squash'] : false
+ is_wip = gitlab_danger.ci? ? gitlab.mr_json['work_in_progress'] : false
is_fixup = commit.message.start_with?('fixup!', 'squash!')
if is_fixup