Skip to content

Commit

Permalink
Merge pull request #1135 from Automattic/iangmaia/dangermattic-setup
Browse files Browse the repository at this point in the history
Add Dangermattic configuration
  • Loading branch information
iangmaia authored Feb 21, 2024
2 parents b356c26 + 9755fb3 commit 747ef11
Show file tree
Hide file tree
Showing 5 changed files with 111 additions and 4 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/run-danger.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: ☢️ Danger

on:
pull_request:
types: [opened, reopened, ready_for_review, synchronize, edited, labeled, unlabeled, milestoned, demilestoned]

jobs:
dangermattic:
# runs on draft PRs only for opened / synchronize events
if: ${{ (github.event.pull_request.draft == false) || (github.event.pull_request.draft == true && contains(fromJSON('["opened", "synchronize"]'), github.event.action)) }}
uses: Automattic/dangermattic/.github/workflows/[email protected]
secrets:
github-token: ${{ secrets.DANGERMATTIC_GITHUB_TOKEN }}
3 changes: 1 addition & 2 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ Layout/LineLength:

Metrics/BlockLength:
Exclude:
- fastlane/*file
- Podfile
- fastlane/Fastfile
- Rakefile

Style/HashSyntax:
Expand Down
42 changes: 42 additions & 0 deletions Dangerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# frozen_string_literal: true

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_all_manifest_lock_updated

podfile_checker.check_podfile_does_not_have_branch_references

ios_release_checker.check_core_data_model_changed
ios_release_checker.check_release_notes_and_app_store_strings

# skip remaining checks if we're in a release-process PR
if github.pr_labels.include?('Releases')
message('This PR has the `Releases` label: some checks will be skipped.')
return
end

common_release_checker.check_internal_release_notes_changed(report_type: :message)

ios_release_checker.check_modified_translations_on_release_branch

view_changes_checker.check

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: ['[Status] DO NOT MERGE'],
required_labels: [//],
required_labels_error: 'PR requires at least one label.'
)

# runs the milestone check if this is not a WIP feature and the PR is against the main branch or the release branch
milestone_checker.check_milestone_due_date(days_before_due: 4) if (github_utils.main_branch? || github_utils.release_branch?) && !github_utils.wip_feature?
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
source 'https://rubygems.org'

gem 'cocoapods', '~> 1.14'
gem 'danger-dangermattic', '~> 1.0'
gem 'fastlane', '~> 2.219'
gem 'fastlane-plugin-appcenter', '~> 1.11'
gem 'fastlane-plugin-sentry', '~> 1.14'
gem 'fastlane-plugin-wpmreleasetoolkit', '~> 9.2'
gem 'rake', '~> 12.3'
gem 'rubocop', '~> 1.18'
gem 'xcpretty-travis-formatter', '~> 1.0'
55 changes: 54 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ GEM
sawyer (>= 0.6)
chroma (0.2.0)
claide (1.1.0)
claide-plugins (0.9.2)
cork
nap
open4 (~> 1.3)
cocoapods (1.14.1)
addressable (~> 2.8)
claide (>= 1.0.2, < 2.0)
Expand Down Expand Up @@ -87,6 +91,44 @@ GEM
highline (~> 2.0.0)
concurrent-ruby (1.2.2)
connection_pool (2.4.1)
cork (0.3.0)
colored2 (~> 3.1)
danger (9.4.3)
claide (~> 1.0)
claide-plugins (>= 0.9.2)
colored2 (~> 3.1)
cork (~> 0.1)
faraday (>= 0.9.0, < 3.0)
faraday-http-cache (~> 2.0)
git (~> 1.13)
kramdown (~> 2.3)
kramdown-parser-gfm (~> 1.0)
no_proxy_fix
octokit (>= 4.0)
terminal-table (>= 1, < 4)
danger-dangermattic (1.0.0)
danger (~> 9.4)
danger-junit (~> 1.0)
danger-plugin-api (~> 1.0)
danger-rubocop (~> 0.12)
danger-swiftlint (~> 0.35)
danger-xcode_summary (~> 1.0)
rubocop (~> 1.60)
danger-junit (1.0.2)
danger (> 2.0)
ox (~> 2.0)
danger-plugin-api (1.0.0)
danger (> 2.0)
danger-rubocop (0.12.0)
danger
rubocop (~> 1.0)
danger-swiftlint (0.35.0)
danger
rake (> 10)
thor (~> 1.0.0)
danger-xcode_summary (1.3.0)
danger-plugin-api (~> 1.0)
xcresult (~> 0.2)
declarative (0.0.20)
diffy (3.4.2)
digest-crc (0.6.5)
Expand Down Expand Up @@ -118,6 +160,8 @@ GEM
faraday-em_http (1.0.0)
faraday-em_synchrony (1.0.0)
faraday-excon (1.1.0)
faraday-http-cache (2.5.1)
faraday (>= 0.8)
faraday-httpclient (1.0.1)
faraday-multipart (1.0.4)
multipart-post (~> 2)
Expand Down Expand Up @@ -243,6 +287,10 @@ GEM
jmespath (1.6.2)
json (2.7.1)
jwt (2.7.1)
kramdown (2.4.0)
rexml
kramdown-parser-gfm (1.1.0)
kramdown (~> 2.0)
language_server-protocol (3.17.0.3)
mini_magick (4.12.0)
mini_mime (1.1.5)
Expand All @@ -256,15 +304,18 @@ GEM
nap (1.1.0)
naturally (2.2.1)
netrc (0.11.0)
no_proxy_fix (0.1.2)
nokogiri (1.15.4)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
octokit (6.1.1)
faraday (>= 1, < 3)
sawyer (~> 0.9)
open4 (1.3.4)
options (2.3.2)
optparse (0.4.0)
os (1.1.4)
ox (2.14.17)
parallel (1.24.0)
parser (3.3.0.5)
ast (~> 2.4.1)
Expand Down Expand Up @@ -320,6 +371,7 @@ GEM
terminal-notifier (2.0.0)
terminal-table (3.0.2)
unicode-display_width (>= 1.1.1, < 3)
thor (1.0.1)
trailblazer-option (0.1.2)
tty-cursor (0.7.1)
tty-screen (0.8.2)
Expand All @@ -343,18 +395,19 @@ GEM
rouge (~> 2.0.7)
xcpretty-travis-formatter (1.0.1)
xcpretty (~> 0.2, >= 0.0.7)
xcresult (0.2.1)

PLATFORMS
ruby

DEPENDENCIES
cocoapods (~> 1.14)
danger-dangermattic (~> 1.0)
fastlane (~> 2.219)
fastlane-plugin-appcenter (~> 1.11)
fastlane-plugin-sentry (~> 1.14)
fastlane-plugin-wpmreleasetoolkit (~> 9.2)
rake (~> 12.3)
rubocop (~> 1.18)
xcpretty-travis-formatter (~> 1.0)

BUNDLED WITH
Expand Down

0 comments on commit 747ef11

Please sign in to comment.