Skip to content

Commit

Permalink
Update danger version and setup
Browse files Browse the repository at this point in the history
  • Loading branch information
iangmaia committed Feb 7, 2024
1 parent da39684 commit 8b8401e
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 75 deletions.
7 changes: 0 additions & 7 deletions .buildkite/commands/danger-pr-check.sh

This file was deleted.

22 changes: 0 additions & 22 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,6 @@ common_params:
propagate-environment: true
environment:
- "RUBYGEMS_API_KEY"
- &docker_plugin_with_danger_token
docker#v5.8.0:
image: *ruby_version
propagate-environment: true
environment:
- "DANGER_GITHUB_API_TOKEN"


steps:
#################
Expand Down Expand Up @@ -55,20 +48,6 @@ steps:
ruby:
- 3.2.2

#################
# Danger
#################
- label: "☢️ Danger - PR Check"
key: danger
command: .buildkite/commands/danger-pr-check.sh
plugins: [*docker_plugin_with_danger_token]
agents:
queue: "default"
retry:
manual:
permit_on_passed: true
if: "build.pull_request.id != null"

#################
# Push to RubyGems
#################
Expand All @@ -78,7 +57,6 @@ steps:
depends_on:
- test
- rubocop
- danger
# Note: We intentionally call a separate `.sh` script here (as opposed to having all the
# commands written inline) to avoid leaking a key used in the process in clear in the
# BUILDKITE_COMMAND environment variable.
Expand Down
11 changes: 11 additions & 0 deletions .github/workflows/run-danger.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: ☢️ Danger

on:
pull_request:
types: [opened, synchronize, edited, review_requested, review_request_removed, labeled, unlabeled, milestoned, demilestoned]

jobs:
dangermattic:
uses: Automattic/dangermattic/.github/workflows/reusable-run-danger.yml@trunk
secrets:
github-token: ${{ secrets.DANGERMATTIC_GITHUB_TOKEN }}
32 changes: 12 additions & 20 deletions Dangerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,18 @@ def gemfile_lock_version
gemfile_lock.scan(/fastlane-plugin-wpmreleasetoolkit \((\d+.\d+.\d+)\)/).last.first
end

# these are reviewers actively providing feedback and potentially changing the state of the PR (approved, changes-requested)
def active_reviewers?
repo_name = github.pr_json['base']['repo']['full_name']
pr_number = github.pr_json['number']
github.dismiss_out_of_range_messages

!github.api.pull_request_reviews(repo_name, pr_number).empty?
end
# `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)

# requested_teams / requested_reviewers are users initially requested to review a PR, who haven't reacted yet
def requested_reviewers?
has_requested_reviews = !github.pr_json['requested_teams'].to_a.empty? || !github.pr_json['requested_reviewers'].to_a.empty?
has_requested_reviews || active_reviewers?
end

return if github.pr_labels.include?('Releases')
manifest_pr_checker.check_gemfile_lock_updated

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

# Before checking the version, get rid of any change that `bundle install`
# might have done.
Expand All @@ -51,17 +46,14 @@ 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

manifest_pr_checker.check_gemfile_lock_updated

labels_checker.check(
do_not_merge_labels: ['Do Not Merge'],
required_labels: [//],
required_labels_error: 'PR requires at least one label.'
)

pr_size_checker.check_diff_size
pr_size_checker.check_diff_size(max_size: 500)

milestone_checker.check_milestone_due_date(days_before_due: 5)

rubocop.lint(inline_comment: true, fail_on_inline_comment: true, include_cop_names: true)

warn("No reviewers have been set for this PR yet. Please request a review from **@\u2028wordpress-mobile/apps-infrastructure**.") unless requested_reviewers?
warn("No reviewers have been set for this PR yet. Please request a review from **@\u2060wordpress-mobile/apps-infrastructure**.") unless github_utils.requested_reviewers? || github.pr_draft?
51 changes: 25 additions & 26 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
GIT
remote: https://github.com/Automattic/dangermattic
revision: 451932e8870ef3c52de0d8bea80edcfa3d879e53
revision: 16456c92c298a795d9dab86fb20b62ae0c6436c4
specs:
danger-dangermattic (0.0.1)
danger (~> 9.3)
danger (~> 9.4)
danger-junit (~> 1.0)
danger-plugin-api (~> 1.0)
danger-rubocop (~> 0.11)
danger-swiftlint (~> 0.29)
danger-rubocop (~> 0.12)
danger-swiftlint (~> 0.35)
danger-xcode_summary (~> 1.0)
rubocop (~> 1.56)
rubocop (~> 1.60)

PATH
remote: .
Expand Down Expand Up @@ -47,7 +47,7 @@ GEM
minitest (>= 5.1)
mutex_m
tzinfo (~> 2.0)
addressable (2.8.5)
addressable (2.8.6)
public_suffix (>= 2.0.2, < 6.0)
algoliasearch (1.27.5)
httpclient (~> 2.8, >= 2.8.3)
Expand All @@ -72,7 +72,7 @@ GEM
aws-sigv4 (1.6.0)
aws-eventstream (~> 1, >= 1.0.2)
babosa (1.0.4)
base64 (0.1.1)
base64 (0.2.0)
bigdecimal (3.1.4)
buildkit (1.5.0)
sawyer (>= 0.6)
Expand Down Expand Up @@ -134,7 +134,7 @@ GEM
colored2 (~> 3.1)
crack (0.4.5)
rexml
danger (9.3.2)
danger (9.4.3)
claide (~> 1.0)
claide-plugins (>= 0.9.2)
colored2 (~> 3.1)
Expand All @@ -145,7 +145,7 @@ GEM
kramdown (~> 2.3)
kramdown-parser-gfm (~> 1.0)
no_proxy_fix
octokit (~> 6.0)
octokit (>= 4.0)
terminal-table (>= 1, < 4)
danger-junit (1.0.2)
danger (> 2.0)
Expand All @@ -155,10 +155,10 @@ GEM
danger-rubocop (0.12.0)
danger
rubocop (~> 1.0)
danger-swiftlint (0.33.0)
danger-swiftlint (0.35.0)
danger
rake (> 10)
thor (~> 0.19)
thor (~> 1.0.0)
danger-xcode_summary (1.2.0)
danger-plugin-api (~> 1.0)
xcresult (~> 0.2)
Expand Down Expand Up @@ -196,7 +196,7 @@ GEM
faraday-em_http (1.0.0)
faraday-em_synchrony (1.0.0)
faraday-excon (1.1.0)
faraday-http-cache (2.5.0)
faraday-http-cache (2.5.1)
faraday (>= 0.8)
faraday-httpclient (1.0.1)
faraday-multipart (1.0.4)
Expand Down Expand Up @@ -253,7 +253,7 @@ GEM
fourflusher (2.3.1)
fuzzy_match (2.0.4)
gh_inspector (1.1.3)
git (1.18.0)
git (1.19.1)
addressable (~> 2.8)
rchardet (~> 1.8)
google-apis-androidpublisher_v3 (0.50.0)
Expand Down Expand Up @@ -302,7 +302,7 @@ GEM
concurrent-ruby (~> 1.0)
java-properties (0.3.0)
jmespath (1.6.2)
json (2.6.3)
json (2.7.1)
jwt (2.7.1)
kramdown (2.4.0)
rexml
Expand All @@ -316,7 +316,7 @@ GEM
minitest (5.20.0)
molinillo (0.8.0)
multi_json (1.15.0)
multipart-post (2.3.0)
multipart-post (2.4.0)
mutex_m (0.1.2)
nanaimo (0.3.0)
nap (1.1.0)
Expand All @@ -334,8 +334,8 @@ GEM
optparse (0.1.1)
os (1.1.4)
ox (2.14.17)
parallel (1.23.0)
parser (3.2.2.4)
parallel (1.24.0)
parser (3.3.0.5)
ast (~> 2.4.1)
racc
plist (3.7.0)
Expand All @@ -346,13 +346,13 @@ GEM
coderay (~> 1.1.0)
method_source (~> 0.9.0)
public_suffix (4.0.7)
racc (1.7.1)
racc (1.7.3)
rainbow (3.1.1)
rake (13.0.6)
rake (13.1.0)
rake-compiler (1.2.5)
rake
rchardet (1.8.0)
regexp_parser (2.8.2)
regexp_parser (2.9.0)
representable (3.2.0)
declarative (< 0.1.0)
trailblazer-option (>= 0.1.1, < 0.2.0)
Expand All @@ -376,19 +376,18 @@ GEM
rspec-support (3.12.1)
rspec_junit_formatter (0.4.1)
rspec-core (>= 2, < 4, != 2.12.0)
rubocop (1.57.1)
base64 (~> 0.1.1)
rubocop (1.60.2)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.2.2.4)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.28.1, < 2.0)
rubocop-ast (>= 1.30.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.29.0)
rubocop-ast (1.30.0)
parser (>= 3.2.1.0)
rubocop-require_tools (0.1.2)
rubocop (>= 0.49.1)
Expand Down Expand Up @@ -419,7 +418,7 @@ GEM
terminal-notifier (2.0.0)
terminal-table (3.0.2)
unicode-display_width (>= 1.1.1, < 3)
thor (0.20.3)
thor (1.0.1)
trailblazer-option (0.1.2)
tty-cursor (0.7.1)
tty-screen (0.8.1)
Expand Down

0 comments on commit 8b8401e

Please sign in to comment.