RuboCop - [AllCops -> Exclude] not working in GitHub Actions

The RuboCop AllCops->Exclude rule does not work using GitHub Actions.

It seems to go into a recursive loop

I have a simple GEM that is using RuboCop with a basic configuration.

AllCops:
  TargetRubyVersion: 2.7
  NewCops: enable

Style/StringLiterals:
  Enabled: true
  EnforcedStyle: double_quotes

Style/StringLiteralsInInterpolation:
  Enabled: true
  EnforcedStyle: double_quotes

Layout/LineLength:
  Max: 120

I need to disable cop rules in two folders.

AllCops:
  TargetRubyVersion: 2.7
  NewCops: enable
  Exclude:
    - ".builders/**/*"
    - "spec/samples/**/*"

WORKS :) Run Rubocop locally with excluded files:

enter image description here

Using GitHub Actions

WORKS :) Run RuboCop without AllCops->Exclude

GHA k_director/runs/4909797149

enter image description here

FAILS :( Run RuboCop sing AllCops->Exclude

GHA k_director/runs/4909833222

I cancelled the workflow at nearly 8 minutes

enter image description here

This action takes it seems to go into a deep tree traversal and locks up my GitHub Actions.

Here is some of the errors 1800 lines into the log

enter image description here

GitHub Action workflow for RuboCop

name: Build Application

on:
  push:
    branches: [ main ]

jobs:
  test:
    runs-on: ubuntu-latest
    name: Ruby ${{ matrix.ruby }}
    strategy:
      matrix:
        ruby: ['2.7.1']

    steps:
    - uses: actions/checkout@v2
    - name: Set up Ruby
      uses: ruby/setup-ruby@v1
      with:
        ruby-version: ${{ matrix.ruby }}
        bundler-cache: true

    - name: Run rubocop
      run: bundle exec rubocop


Solution 1:

I first tried to the venders directory into the exclusions.

AllCops:
  Exclude:
    - 'vendor/**/*'

I found the answer here: How to Setup RuboCop in GitHub Actions

This worked for me, but @AndyWait pointed me to a section in the documentation and my current working solution is to add the following, which will merge my new exclusions with the exclusions that are in the rubocop->default.yml

inherit_mode:
  merge:
    - Exclude