-
Notifications
You must be signed in to change notification settings - Fork 9
/
Dangerfile
52 lines (39 loc) · 1.84 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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# frozen_string_literal: true
def version
lib = File.expand_path('lib', __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'fastlane/plugin/wpmreleasetoolkit/version'
Fastlane::Wpmreleasetoolkit::VERSION
end
def gemfile_lock_version
gemfile_lock = File.read('./Gemfile.lock')
gemfile_lock.scan(/fastlane-plugin-wpmreleasetoolkit \((\d+.\d+.\d+)\)/).last.first
end
github.dismiss_out_of_range_messages
# `files: []` forces rubocop to scan all files, not just the ones modified in the PR
rubocop.lint(files: [], force_exclusion: true, inline_comment: true, fail_on_inline_comment: true, include_cop_names: true)
manifest_pr_checker.check_gemfile_lock_updated
if version.to_s != gemfile_lock_version.to_s
message = <<~MESSAGE
The version in the `Gemfile.lock` (`#{gemfile_lock_version}`) doesn't match the one in `version.rb` (`#{version}`).
Please run `bundle install` to make sure they match.
MESSAGE
failure(message)
end
# Check that the PR contains changes to the CHANGELOG.md file.
# - If it's a feature PR, CHANGELOG should have a new entry describing the changes
# - If it's a release PR, we expect the CHANGELOG to have been updated during `rake new_release` with updated section title + new placeholder section
unless git.modified_files.include?('CHANGELOG.md')
warn 'Please add an entry in the CHANGELOG.md file to describe the changes made by this PR'
end
pr_size_checker.check_diff_size(max_size: 500)
# skip remaining checks if the PR is still a Draft
if github.pr_draft?
message('This PR is still a Draft: some checks will be skipped.')
return
end
labels_checker.check(
do_not_merge_labels: ['Do Not Merge'],
required_labels: []
)
warn("No reviewers have been set for this PR yet. Please request a review from **@\u2060wordpress-mobile/apps-infrastructure**.") unless github_utils.requested_reviewers?