summaryrefslogtreecommitdiff
path: root/danger
diff options
context:
space:
mode:
authorYorick Peterse <yorickpeterse@gmail.com>2018-11-06 15:20:33 +0100
committerYorick Peterse <yorickpeterse@gmail.com>2018-11-07 15:27:39 +0100
commitedd3e107c65edda75ec83398ff6fe031fbe1b4a6 (patch)
tree103eb1444e4bd2bdba36d9d5d98e2e2350837d61 /danger
parentc8b6b9f243312262e5975185f4287f7fa666f717 (diff)
downloadgitlab-ce-edd3e107c65edda75ec83398ff6fe031fbe1b4a6.tar.gz
Warn when MR titles are too longdanger-mr-title-warning
This adds a Danger check to produce a warning for MR titles greater than 72 characters. This is necessary because when squash on merge is used, the MR title will be used for the commit message (at least by default). This in turn leads to commit messages that violate our commit message guidelines. For more information, refer to https://gitlab.com/gitlab-org/release/framework/issues/24.
Diffstat (limited to 'danger')
-rw-r--r--danger/metadata/Dangerfile7
1 files changed, 7 insertions, 0 deletions
diff --git a/danger/metadata/Dangerfile b/danger/metadata/Dangerfile
index 51fc9e6bfca..1adca152736 100644
--- a/danger/metadata/Dangerfile
+++ b/danger/metadata/Dangerfile
@@ -23,3 +23,10 @@ has_pick_into_stable_label = gitlab.mr_labels.find { |label| label.start_with?('
if gitlab.branch_for_base != "master" && !has_pick_into_stable_label
warn "Most of the time, merge requests should target `master`. Otherwise, please set the relevant `Pick into X.Y` label."
end
+
+if gitlab.mr_json['title'].length > 72
+ warn 'The title of this merge request is longer than 72 characters and ' \
+ 'would violate our commit message rules when using the Squash on Merge ' \
+ 'feature. Please consider adjusting the title, or rebase the ' \
+ "commits manually and don't use Squash on Merge."
+end