diff options
-rw-r--r-- | .gitattributes | 1 | ||||
-rw-r--r-- | .gitlab-ci.yml | 7 | ||||
-rw-r--r-- | Dangerfile | 19 |
3 files changed, 27 insertions, 0 deletions
diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..f1c41c9bb --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +Dangerfile gitlab-language=ruby diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index deed4ed78..a2ed59b72 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -14,6 +14,13 @@ verify: script: - make verify +danger-review: + stage: build + script: + - git version + - gem install danger-gitlab --no-document + - danger + .ruby_template: &ruby_definition before_script: # Override gemfile config (for some reasong `config --delete` doesn't do it) 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 |