Skip to content

Commit a898e64

Browse files
authored
Dangermattic checks update (#22553)
2 parents 5e53374 + b9109ee commit a898e64

4 files changed

Lines changed: 55 additions & 53 deletions

File tree

.github/workflows/run-danger.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@ name: ☢️ Danger
22

33
on:
44
pull_request:
5-
types: [opened, synchronize, edited, review_requested, review_request_removed, labeled, unlabeled, milestoned, demilestoned]
5+
types: [opened, reopened, ready_for_review, synchronize, edited, labeled, unlabeled, milestoned, demilestoned]
66

77
jobs:
88
dangermattic:
9-
uses: Automattic/dangermattic/.github/workflows/reusable-run-danger.yml@trunk
9+
# runs on draft PRs only for opened / synchronize events
10+
if: ${{ (github.event.pull_request.draft == false) || (github.event.pull_request.draft == true && contains(fromJSON('["opened", "synchronize"]'), github.event.action)) }}
11+
uses: Automattic/dangermattic/.github/workflows/reusable-run-danger.yml@v1.0.0
1012
secrets:
1113
github-token: ${{ secrets.DANGERMATTIC_GITHUB_TOKEN }}

Dangerfile

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,42 @@
11
# frozen_string_literal: true
22

3-
def release_branch?
4-
danger.github.branch_for_base.start_with?('release/') || danger.github.branch_for_base.start_with?('hotfix/')
5-
end
3+
github.dismiss_out_of_range_messages
64

7-
def main_branch?
8-
danger.github.branch_for_base == 'trunk'
9-
end
5+
# `files: []` forces rubocop to scan all files, not just the ones modified in the PR
6+
rubocop.lint(files: [], force_exclusion: true, inline_comment: true, fail_on_inline_comment: true, include_cop_names: true)
107

11-
def wip_feature?
12-
has_wip_label = github.pr_labels.any? { |label| label.include?('WIP') }
13-
has_wip_title = github.pr_title.include?('WIP')
8+
manifest_pr_checker.check_all_manifest_lock_updated
149

15-
has_wip_label || has_wip_title
10+
podfile_checker.check_podfile_does_not_have_branch_references
11+
12+
ios_release_checker.check_core_data_model_changed
13+
ios_release_checker.check_release_notes_and_app_store_strings
14+
15+
# skip remaining checks if we're in a release-process PR
16+
if github.pr_labels.include?('Releases')
17+
message('This PR has the `Releases` label: some checks will be skipped.')
18+
return
1619
end
1720

18-
return if github.pr_labels.include?('Releases')
21+
common_release_checker.check_internal_release_notes_changed(report_type: :message)
1922

20-
github.dismiss_out_of_range_messages
23+
ios_release_checker.check_modified_translations_on_release_branch
2124

22-
manifest_pr_checker.check_all_manifest_lock_updated
25+
view_changes_checker.check
26+
27+
pr_size_checker.check_diff_size(max_size: 500)
28+
29+
# skip remaining checks if the PR is still a Draft
30+
if github.pr_draft?
31+
message('This PR is still a Draft: some checks will be skipped.')
32+
return
33+
end
2334

2435
labels_checker.check(
2536
do_not_merge_labels: ['[Status] DO NOT MERGE'],
2637
required_labels: [//],
2738
required_labels_error: 'PR requires at least one label.'
2839
)
2940

30-
view_changes_need_screenshots.view_changes_need_screenshots
31-
32-
pr_size_checker.check_diff_size
33-
34-
# skip check for draft PRs and for WIP features unless the PR is against the main branch or release branch
35-
milestone_checker.check_milestone_due_date(days_before_due: 4) unless github.pr_draft? || (wip_feature? && !(release_branch? || main_branch?))
36-
37-
rubocop.lint(inline_comment: true, fail_on_inline_comment: true, include_cop_names: true)
41+
# runs the milestone check if this is not a WIP feature and the PR is against the main branch or the release branch
42+
milestone_checker.check_milestone_due_date(days_before_due: 4) if (github_utils.main_branch? || github_utils.release_branch?) && !github_utils.wip_feature?

Gemfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ source 'https://rubygems.org'
44

55
gem 'cocoapods', '~> 1.14'
66
gem 'commonmarker'
7-
gem 'danger-dangermattic', git: 'https://github.com/Automattic/dangermattic'
7+
gem 'danger-dangermattic', '~> 1.0'
88
gem 'dotenv'
99
# 2.219.0 includes a fix for a bug introduced in 2.218.0
1010
# See https://github.com/fastlane/fastlane/issues/21762#issuecomment-1875208663
@@ -18,7 +18,7 @@ gem 'fastlane-plugin-sentry'
1818
# gem 'fastlane-plugin-wpmreleasetoolkit', git: 'https://github.com/wordpress-mobile/release-toolkit', ref: '2cb009edaee3d058a61cfeb503e533eb0647f108'
1919
gem 'fastlane-plugin-wpmreleasetoolkit', '~> 9.3'
2020
gem 'rake'
21-
gem 'rubocop', '~> 1.30'
21+
gem 'rubocop', '~> 1.60'
2222
gem 'rubocop-rake', '~> 0.6'
2323
gem 'xcpretty-travis-formatter'
2424

Gemfile.lock

Lines changed: 23 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,3 @@
1-
GIT
2-
remote: https://github.com/Automattic/dangermattic
3-
revision: 06a54db4f546d20c0465e4d144049d061a2a1e20
4-
specs:
5-
danger-dangermattic (0.0.1)
6-
danger (~> 9.3)
7-
danger-junit (~> 1.0)
8-
danger-plugin-api (~> 1.0)
9-
danger-rubocop (~> 0.11)
10-
danger-swiftlint (~> 0.29)
11-
danger-xcode_summary (~> 1.0)
12-
rubocop (~> 1.56)
13-
141
GEM
152
remote: https://rubygems.org/
163
specs:
@@ -107,7 +94,7 @@ GEM
10794
connection_pool (2.4.1)
10895
cork (0.3.0)
10996
colored2 (~> 3.1)
110-
danger (9.3.2)
97+
danger (9.4.3)
11198
claide (~> 1.0)
11299
claide-plugins (>= 0.9.2)
113100
colored2 (~> 3.1)
@@ -118,8 +105,16 @@ GEM
118105
kramdown (~> 2.3)
119106
kramdown-parser-gfm (~> 1.0)
120107
no_proxy_fix
121-
octokit (~> 6.0)
108+
octokit (>= 4.0)
122109
terminal-table (>= 1, < 4)
110+
danger-dangermattic (1.0.0)
111+
danger (~> 9.4)
112+
danger-junit (~> 1.0)
113+
danger-plugin-api (~> 1.0)
114+
danger-rubocop (~> 0.12)
115+
danger-swiftlint (~> 0.35)
116+
danger-xcode_summary (~> 1.0)
117+
rubocop (~> 1.60)
123118
danger-junit (1.0.2)
124119
danger (> 2.0)
125120
ox (~> 2.0)
@@ -128,10 +123,10 @@ GEM
128123
danger-rubocop (0.12.0)
129124
danger
130125
rubocop (~> 1.0)
131-
danger-swiftlint (0.33.0)
126+
danger-swiftlint (0.35.0)
132127
danger
133128
rake (> 10)
134-
thor (~> 0.19)
129+
thor (~> 1.0.0)
135130
danger-xcode_summary (1.2.0)
136131
danger-plugin-api (~> 1.0)
137132
xcresult (~> 0.2)
@@ -166,7 +161,7 @@ GEM
166161
faraday-em_http (1.0.0)
167162
faraday-em_synchrony (1.0.0)
168163
faraday-excon (1.1.0)
169-
faraday-http-cache (2.5.0)
164+
faraday-http-cache (2.5.1)
170165
faraday (>= 0.8)
171166
faraday-httpclient (1.0.1)
172167
faraday-multipart (1.0.4)
@@ -304,7 +299,7 @@ GEM
304299
minitest (5.21.2)
305300
molinillo (0.8.0)
306301
multi_json (1.15.0)
307-
multipart-post (2.3.0)
302+
multipart-post (2.4.0)
308303
mutex_m (0.2.0)
309304
nanaimo (0.3.0)
310305
nap (1.1.0)
@@ -323,7 +318,7 @@ GEM
323318
os (1.1.4)
324319
ox (2.14.17)
325320
parallel (1.24.0)
326-
parser (3.2.2.4)
321+
parser (3.3.0.5)
327322
ast (~> 2.4.1)
328323
racc
329324
plist (3.7.1)
@@ -337,7 +332,7 @@ GEM
337332
rake-compiler (1.2.7)
338333
rake
339334
rchardet (1.8.0)
340-
regexp_parser (2.8.0)
335+
regexp_parser (2.9.0)
341336
representable (3.2.0)
342337
declarative (< 0.1.0)
343338
trailblazer-option (>= 0.1.1, < 0.2.0)
@@ -346,18 +341,18 @@ GEM
346341
rexml (3.2.6)
347342
rmagick (3.2.0)
348343
rouge (2.0.7)
349-
rubocop (1.57.2)
344+
rubocop (1.60.2)
350345
json (~> 2.3)
351346
language_server-protocol (>= 3.17.0)
352347
parallel (~> 1.10)
353-
parser (>= 3.2.2.4)
348+
parser (>= 3.3.0.2)
354349
rainbow (>= 2.2.2, < 4.0)
355350
regexp_parser (>= 1.8, < 3.0)
356351
rexml (>= 3.2.5, < 4.0)
357-
rubocop-ast (>= 1.28.1, < 2.0)
352+
rubocop-ast (>= 1.30.0, < 2.0)
358353
ruby-progressbar (~> 1.7)
359354
unicode-display_width (>= 2.4.0, < 3.0)
360-
rubocop-ast (1.28.1)
355+
rubocop-ast (1.30.0)
361356
parser (>= 3.2.1.0)
362357
rubocop-rake (0.6.0)
363358
rubocop (~> 1.0)
@@ -380,7 +375,7 @@ GEM
380375
terminal-notifier (2.0.0)
381376
terminal-table (3.0.2)
382377
unicode-display_width (>= 1.1.1, < 3)
383-
thor (0.20.3)
378+
thor (1.0.1)
384379
trailblazer-option (0.1.2)
385380
tty-cursor (0.7.1)
386381
tty-screen (0.8.2)
@@ -412,15 +407,15 @@ PLATFORMS
412407
DEPENDENCIES
413408
cocoapods (~> 1.14)
414409
commonmarker
415-
danger-dangermattic!
410+
danger-dangermattic (~> 1.0)
416411
dotenv
417412
fastlane (~> 2.219)
418413
fastlane-plugin-appcenter (~> 2.1)
419414
fastlane-plugin-sentry
420415
fastlane-plugin-wpmreleasetoolkit (~> 9.3)
421416
rake
422417
rmagick (~> 3.2.0)
423-
rubocop (~> 1.30)
418+
rubocop (~> 1.60)
424419
rubocop-rake (~> 0.6)
425420
xcpretty-travis-formatter
426421

0 commit comments

Comments
 (0)