Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update example to use Bundler #97

Merged
merged 1 commit into from
Feb 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 23 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,30 +100,44 @@ Optional. Run Rubocop with bundle exec. Default: `false`.

## Example usage

You can create [RuboCop Configuration](https://docs.rubocop.org/rubocop/configuration.html) and this action uses that config too.
This action will use your [RuboCop Configuration](https://docs.rubocop.org/rubocop/configuration.html) automatically.

In your `Gemfile`, ensure all Rubocop gems are in a named (e.g. rubocop) group:

```ruby
group :development, :rubocop do
gem 'rubocop', require: false
gem 'rubocop-rails', require: false
# ...
end
```

Create the following workflow. The `BUNDLE_ONLY` environment variable will tell Bundler to only install the specified group.

```yml
name: reviewdog
on: [pull_request]
on:
pull_request:
permissions:
contents: read
pull-requests: write
jobs:
rubocop:
name: runner / rubocop
runs-on: ubuntu-latest
env:
BUNDLE_ONLY: rubocop
steps:
- name: Check out code
uses: actions/checkout@v4
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: 3.0.0
- name: rubocop
uses: reviewdog/action-rubocop@v2
ruby-version: '3.3'
bundler-cache: true
- uses: reviewdog/action-rubocop@v2
with:
rubocop_version: gemfile
rubocop_extensions: rubocop-rails:gemfile rubocop-rspec:gemfile
reporter: github-pr-review # Default is github-pr-check
skip_install: true
use_bundler: true
```

## Sponsor
Expand Down