Verifying setup for RuboCop… bundler: failed to load command: rubocop
See original GitHub issueHello,
I’m trying to use this with rubocop, to automatically fix the files, with the following configuration:
- name: Run lint
uses: wearerequired/lint-action@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
rubocop: true
auto_fix: true
rubocop_args: --fail-level C --display-only-fail-level-offenses
rubocop_command_prefix: bundle exec
Previous to that I have
jobs:
run-linters:
name: Rubocop auto-fix
runs-on: ubuntu-18.04
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7.1
- name: Ruby gem cache
uses: actions/cache@v1
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-
- name: Install gems
run: |
bundle config path vendor/bundle
bundle install --jobs 4 --retry 3
When the action runs, it errors with the following message:
Verifying setup for RuboCop…
bundler: failed to load command: rubocop (/home/runner/work/{my_repo}/vendor/bundle/ruby/2.7.0/bin/rubocop)
Error: RuboCop is not installed
I checked the files in verifySetup of rubocop, and it just runs
{prefix} rubocop -v, which would be bundle exec rubocop -v in my case.
I made a step in the action with:
- name: Check bundle version
run: bundle exec rubocop -v
And it outputs 1.1.0, which is the version my gemfile.lock has. I don’t understand why when the verifySetup of rubocop.js runs that exact same command, it fails and doesn’t work, giving the “failed to load command: rubocop”. Changing the rubocop_dir will output that rubocop is not installed.
Even removing the -v in the last example does run rubocop, although it’s not what I want, because I can’t use this action that way.
Does anybody know what the problem could be?
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (1 by maintainers)

Top Related StackOverflow Question
I encountered the same issue yesterday. I think this
github actiondoes not automatically usesbundle exec. Addingrubocop_command_prefixresolved the issue for me.A stale label has been added to this issue because it has been open 15 days with no activity. To keep this issue open, add a comment within 5 days.