Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZeger-Jan van de Weg <git@zjvandeweg.nl>2018-05-03 16:08:16 +0300
committerZeger-Jan van de Weg <git@zjvandeweg.nl>2018-05-07 13:26:33 +0300
commita3773bec2f2429f5a3033bfbefd195ecfacd8769 (patch)
tree2e9c45b882490b122e8db719a19c60b4d0508edb /Dangerfile
parente809529c0b7ef0b1892b8e61cef7acda55300d08 (diff)
Improve changelog entry checks using Danger
Check if the changelog entry matches the MR title, and if the web url is listed in the change, so no typo's can be made. For speed we're using a slightly different container. Fixes https://gitlab.com/gitlab-org/gitaly/issues/1176
Diffstat (limited to 'Dangerfile')
-rw-r--r--Dangerfile20
1 files changed, 18 insertions, 2 deletions
diff --git a/Dangerfile b/Dangerfile
index b3845f894..3afa7a26d 100644
--- a/Dangerfile
+++ b/Dangerfile
@@ -1,7 +1,23 @@
-unless git.modified_files.include?("CHANGELOG.md")
- warn("This MR is missing a CHANGELOG entry")
+CHANGELOG_FILE = "CHANGELOG.md"
+
+def check_changelog
+ unless git.modified_files.include?(CHANGELOG_FILE)
+ warn("This MR is missing a CHANGELOG entry")
+ return
+ end
+
+ patch = git.diff_for_file(CHANGELOG_FILE).patch
+ unless patch.match?(/^\+- #{Regexp.quote(gitlab.mr_title)}\n/)
+ fail('Changelog entry should match the MR title')
+ end
+
+ unless patch.match?(/^\+\s+#{Regexp.quote(gitlab.mr_json['web_url'])}\n/)
+ fail('Changelog entry URL does not match the web url')
+ end
end
+check_changelog
+
fail("Please provide a MR description") if gitlab.mr_body.empty?
VENDOR_JSON = 'vendor/vendor.json'