reviewdog / action-rubocop

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

action-rubocop stopped working because it is apparently using wrong version of ruby #119

Closed leticiarodrigues5 closed 1 month ago

leticiarodrigues5 commented 1 month ago

So, this happened suddenly, was working until last friday.

Run reviewdog/action-rubocop@v2.5.0
Run $GITHUB_ACTION_PATH/script.sh
🐶 Installing reviewdog ... https://github.com/reviewdog/reviewdog
 Installing rubocop with extensions ... https://github.com/rubocop/rubocop
  Successfully installed unicode-display_width-1.8.0
  Successfully installed ruby-progressbar-1.13.0
  Successfully installed ast-2.4.2
  Successfully installed parser-3.3.4.2
  Successfully installed rubocop-ast-1.32.0
  Successfully installed regexp_parser-2.9.2
  Successfully installed rainbow-3.1.1
  Successfully installed parallel-1.26.2
  Successfully installed rubocop-1.7.0
  9 gems installed
  ERROR:  Error installing rubocop-rails:
    The last version of activesupport (>= 4.2.0) to support your Ruby & RubyGems was 7.1.3.4. Try installing it with `gem install activesupport -v 7.1.3.4` and then running the current command again
    activesupport requires Ruby version >= 3.1.0. The current ruby version is 2.7.1.83.
  Successfully installed rack-3.1.7
  Successfully installed securerandom-0.3.1
  Successfully installed drb-2.2.1
  Successfully installed base64-0.2.0
  Successfully installed connection_pool-2.4.1
  Successfully installed concurrent-ruby-1.3.4
  Successfully installed tzinfo-2.0.6
  Successfully installed i18n-1.[14](https://github.com/isohub-br/photo-webapp/actions/runs/10358426537/job/28672604393?pr=1989#step:4:15).5
  Error: Process completed with exit code 1.

This is my workflow:

  rubocop:
    name: rubocop
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v2
      - name: Set up Ruby 2.7.1
        uses: ruby/setup-ruby@v1.152.0
        with:
          ruby-version: 2.7.1
      - name: run rubocop
        uses: reviewdog/action-rubocop@v2.5.0
        with:
          rubocop_version: gemfile
          rubocop_extensions: rubocop-rails:gemfile rubocop-rspec:gemfile
          reporter: github-pr-review
leofin commented 1 month ago

Hello,

I had the same issue. I solved it with two things: I added the activesupport to the rubocop_extensions like that.

rubocop_extensions: activesupport:gemfile rubocop-performance:gemfile rubocop-rails:gemfile rubocop-rspec:gemfile

and I fixed the version of the activesupport I need in my Gemfile.

gem 'activesupport', '~> 6.0', '>= 6.0.6.1'

This is the version I used because we are still using Rails 6.0.

I hope it works for you too.

The reason for the error is that some of your dependencies probably like mine didn't specify the maximum version, now that they released the new version of ActiveSupport pointing to ruby 3.1, your gems are downloading the latest and giving you the error. https://rubygems.org/gems/activesupport

javierjulio commented 1 month ago

@leticiarodrigues5 as @leofin mentioned this is due to your dependencies and not related to the action. Worth noting though, that we don't recommend using the action-rubocop extensions approach. It's recommended you replace it with this example setup in the documentation today where the host project's Gemfile will be used instead. Thank you.