diff options
author | Zeger-Jan van de Weg <git@zjvandeweg.nl> | 2018-04-23 12:53:05 +0300 |
---|---|---|
committer | Zeger-Jan van de Weg <git@zjvandeweg.nl> | 2018-04-23 15:59:58 +0300 |
commit | 820958bf9c58bf36fa07d7b7fe196c06e4463e1f (patch) | |
tree | c2849b807a79337c264b47e298ac8334a676baa0 /Dangerfile | |
parent | f7fa70ae1c601d9bfde7583a06406d1973bf58ea (diff) |
Use danger-gitlab to auto review merge requests
Given failures to check simple things in the past, like if a changelog
was present, danger-gitlab is introduced to automatically perform these
tasks.
A warning was added when a changelog entry is skipped, and failures are
due to missing MR descriptions or gitaly-proto versions being incorrect.
To force diff highlighting to work, `.gitattributes` was added.
Diffstat (limited to 'Dangerfile')
-rw-r--r-- | Dangerfile | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/Dangerfile b/Dangerfile new file mode 100644 index 000000000..c1ffd180f --- /dev/null +++ b/Dangerfile @@ -0,0 +1,19 @@ +unless git.modified_files.include?("CHANGELOG.md") + warn("This MR is missing a CHANGLOG entry") +end + +fail("Please provide a MR description") if gitlab.mr_body.empty? + +VENDOR_JSON = 'vendor/vendor.json' +fail("Expected #{VENDOR_JSON} to exist") unless File.exist?(VENDOR_JSON) + +if git.modified_files.include?(VENDOR_JSON) + require 'json' + parsed_json = JSON.parse(File.read(VENDOR_JSON)) + + proto = parsed_json["package"]&.find { |h| h["path"].start_with?("gitlab.com/gitlab-org/gitaly-proto") } + + unless proto["version"] && proto["version"] =~ /\Av\d+\./ + fail("gitaly-proto version is incorrect") + end +end |