reviewdog / action-rubocop

Run rubocop with reviewdog 🐶
MIT License
115 stars 75 forks source link

gemfile version does not work because of pcregrep not found #31

Closed Slike9 closed 3 years ago

Slike9 commented 3 years ago

gemfile version does not work because of "pcregrep: not found"

/home/runner/work/_actions/reviewdog/action-rubocop/master/script.sh: 24: /home/runner/work/_actions/reviewdog/action-rubocop/master/script.sh: pcregrep: not found
  Cannot get the rubocop's version from Gemfile.lock. The latest version will be installed.

Tested on v1 and master. Seems the problem started from v1.8, after migrating from Dockerfile.

GH-workflow config:

name: Lint
on:
  pull_request:
jobs:
  ruby:
    name: Ruby
    runs-on: ubuntu-latest
    steps:
      - name: Check out code
        uses: actions/checkout@v2
      - uses: ruby/setup-ruby@v1
      - name: Run Rubocop
        uses: reviewdog/action-rubocop@master
        with:
          rubocop_version: gemfile
          rubocop_extensions: rubocop-rails:gemfile
          github_token: ${{ secrets.github_token }}
          reporter: github-pr-review

Problem screenshot: Screenshot from 2021-02-20 01-24-24

Action: https://github.com/Slike9/rails-test-prj/runs/1938560595?check_suite_focus=true

Possible solutions:

Slike9 commented 3 years ago

Using Ruby one-liner:

RUBOCOP_GEMFILE_VERSION=$(ruby -ne 'print $& if /^\s{4}rubocop\s\(\K.*(?=\))/' Gemfile.lock)
mgrachev commented 3 years ago

@Slike9 Hey 👋 Thank you for your help!

mgrachev commented 3 years ago

Fixed in v1.8.1. Thanks ✌️