-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dangerfile
31 lines (18 loc) · 1.32 KB
/
Dangerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
warn "#{gitlab.html_link("meta/main.yml")} was edited." if git.modified_files.include? "meta/main.yml"
warn "#{gitlab.html_link("defaults/main.yml")} was edited." if git.modified_files.include? "defaults/main.yml"
warn "#{gitlab.html_link("vars/main.yml")} was edited." if git.modified_files.include? "vars/main.yml"
if git.modified_files.include? "config/*.js"
config_files = git.modified_files.select { |path| path.include? "config/" }
message "This MR changes #{ gitlab.html_link(config_files) }"
end
message "Welcome, Lordoftheflies." if gitlab.mr_author == "lordoftheflies"
can_merge = gitlab.mr_json["mergeable"]
warn("This MR cannot be merged yet.") unless can_merge
has_milestone = gitlab.mr_json["milestone"] != nil
warn("This MR does not refer to an existing milestone", sticky: true) unless has_milestone
failure "Please re-submit this MR to develop, we may have already fixed your issue." if gitlab.branch_for_merge != "develop"
failure "Please provide a summary in the Merge Request description" if gitlab.mr_body.length < 5
warn "This MR does not have any assignees yet." unless gitlab.mr_json["assignee"]
failure "Please add labels to this MR" if gitlab.mr_labels.empty?
declared_trivial = (gitlab.mr_title + gitlab.mr_body).include?("#trivial")
warn "MR is classed as Work in Progress" if gitlab.mr_title.include? "[WIP]"