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>2019-02-27 22:57:53 +0300
committerZeger-Jan van de Weg <git@zjvandeweg.nl>2019-02-28 13:57:21 +0300
commit9a36582c77764f12173261a3476cda2446e54e33 (patch)
tree0161ba6c2dbc81687eb813f08c9a08a4a586cd38 /Dangerfile
parentd92c70a3e87a9fabccdbff5e88548b62e4f77efb (diff)
Have GitalyBot apply labels throught Danger
Using Danger a small rule book, @GitalyBot will apply labels and have a few more rules on the changelog.
Diffstat (limited to 'Dangerfile')
-rw-r--r--Dangerfile44
1 files changed, 4 insertions, 40 deletions
diff --git a/Dangerfile b/Dangerfile
index f1bb16150..a06699f6c 100644
--- a/Dangerfile
+++ b/Dangerfile
@@ -1,42 +1,6 @@
-require 'yaml'
-require 'json'
-
-fail("Please provide a MR description") if gitlab.mr_body.empty?
-
-def check_changelog(path)
- if git.modified_files.include?("CHANGELOG.md")
- fail("CHANGELOG.md was edited. Please remove the additions and create an entry with _support/changelog")
- return
- end
-
- if !git.added_files.include?(path)
- warn("No changelog entry was generated, please do so by executing _support/changelog")
- else
- yaml = YAML.safe_load(File.read(path))
-
- unless yaml['merge_request'] == gitlab.mr_json["iid"]
- fail("Merge request ID was not set to #{gitlab.mr_json['iid']}")
- end
-
- unless yaml['title'] == gitlab.mr_title
- fail('Changelog entry should match the MR title')
- end
- end
-end
-
-check_changelog(File.join('changelogs', 'unreleased', "#{gitlab.branch_for_head}.yml"))
-
-VENDOR_JSON = 'vendor/vendor.json'
-fail("Expected #{VENDOR_JSON} to exist") unless File.exist?(VENDOR_JSON)
-
-if git.modified_files.include?(VENDOR_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
+danger.import_dangerfile(path: 'danger/changelog')
+danger.import_dangerfile(path: 'danger/govendor_proto_check')
+danger.import_dangerfile(path: 'danger/labels')
+danger.import_dangerfile(path: 'danger/merge_request')
# vim: ft=ruby