Skip to content

Commit

Permalink
Merge pull request #59 from rubocop/add-danger-for-enabled-true-cop
Browse files Browse the repository at this point in the history
Add a Danger check to prevent review approval for cops that have become `Enabled: true`
  • Loading branch information
ydah authored Aug 7, 2023
2 parents b7cc1fe + b32223f commit 31bd569
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/danger.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Danger
on:
- pull_request
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
danger:
name: Danger
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
ruby-version: "3.2"
- name: Run Danger
run: bundle exec danger
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
9 changes: 9 additions & 0 deletions Dangerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# frozen_string_literal: true

diff = git.diff_for_file('config/default.yml')
if diff && diff.patch =~ /^\+\s*Enabled: true$/
warn(<<~MESSAGE)
There is a cop that became `Enabled: true` due to this pull request.
Please review the diff and make sure there are no issues.
MESSAGE
end
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ source 'https://rubygems.org'
gemspec

gem 'bump'
gem 'danger'
gem 'rack'
gem 'rake'
gem 'rspec', '~> 3.11'
Expand Down

0 comments on commit 31bd569

Please sign in to comment.