-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathDangerfile
29 lines (22 loc) · 883 Bytes
/
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
message "Thanks @#{github.pr_author}!"
if github.pr_body.length == 0
fail "Please provide a summary in the Pull Request description."
end
if git.lines_of_code > 500
warn "Please consider breaking up this pull request."
end
if git.deletions > git.insertions
message "🎉 Code Cleanup!"
end
if !git.modified_files.include?("CHANGELOG.md")
fail "Please update CHANGELOG.md with relevant information."
end
# Notify of outdated dependencies
dependencyReportsFile = "app/build/dependencyUpdates/report.txt"
dependencyUpdatesHeader = "The following dependencies have later milestone versions:"
hasDependencyUpdatesHeader = File.readlines(dependencyReportsFile).grep(/#{dependencyUpdatesHeader}/).any?
if hasDependencyUpdatesHeader
file = File.open(dependencyReportsFile, "rb").read
index = file.index(dependencyUpdatesHeader)
message file.slice(index..-1)
end