From d2798d607e11e0ebae83ae909404834388733428 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Mon, 16 Sep 2019 12:06:26 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- danger/commit_messages/Dangerfile | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'danger') 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 -- cgit v1.2.3