This repository has been archived by the owner on Aug 18, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathDangerfile
32 lines (26 loc) · 1.75 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
32
# Sometimes its a README fix, or something like that - which isn't relevant for
# including in a CHANGELOG for example
not_declared_trivial = !github.pr_title.include?('#trivial')
has_source_changes = !git.modified_files.grep(/Sources/).empty?
# Changelog entries are required for changes to library files.
no_changelog_entry = !git.modified_files.include?('CHANGELOG.md')
if has_source_changes && no_changelog_entry && not_declared_trivial
warn 'Any changes to library code should be reflected in the Changelog. Please consider adding a note there. \nYou can find it at [CHANGELOG.md](https://github.com/pusher/chatkit-swift/blob/master/CHANGELOG.md).'
end
# Make it more obvious that a PR is a work in progress and shouldn't be merged yet
warn 'PR is classed as Work in Progress' if github.pr_title.include? '[WIP]'
# Warn when either the podspec or Cartfile + Cartfile.resolved has been updated,
# but not both.
podspec_updated = !git.modified_files.grep(/PusherChatkit.podspec/).empty?
cartfile_updated = !git.modified_files.grep(/Cartfile/).empty?
cartfile_resolved_updated = !git.modified_files.grep(/Cartfile.resolved/).empty?
if podspec_updated && (!cartfile_updated || !cartfile_resolved_updated)
warn 'The `podspec` was updated, but there were no changes in either the `Cartfile` nor `Cartfile.resolved`. Did you forget updating `Cartfile` or `Cartfile.resolved`?'
end
if (cartfile_updated || cartfile_resolved_updated) && !podspec_updated
warn 'The `Cartfile` or `Cartfile.resolved` was updated, but there were no changes in the `podspec`. Did you forget updating the `podspec`?'
end
# Warn when there are merge conflicts in the diff
if git.commits.any? { |c| c.message =~ /^Merge branch 'master'/ }
warn 'Please rebase to get rid of the merge commits in this PR'
end