
# Don't bother with rubocop. It is too opinionated and the opinions
# change. It's not worth chasing when the code is perfectly acceptable
# otherwise.

name: Rubocop Check

on:
  push:
    branches:
      - develop
      - master
    paths:
      - ".rubocop*.yml"
      - ".github/workflows/rubocop.yml"
      - "lib/**/*.rb"
      - "test/*.rb"
      - "**/*.gemspec"
      - "**/*.gemfile"
      - "Gemfile"
  pull_request:
    paths:
      - ".rubocop*.yml"
      - ".github/workflows/rubocop.yml"
      - "lib/**/*.rb"
      - "test/*.rb"
      - "**/*.gemspec"
      - "**/*.gemfile"
      - "Gemfile"

jobs:
  formatting-check:
    name: Formatting Check

    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v3

      - name: Set up Ruby
        uses: ruby/setup-ruby@v1
        with:
          ruby-version: "3.2"
          bundler-cache: true

      - name: Set-up RuboCop Problem Matcher
        uses: r7kamura/rubocop-problem-matchers-action@v1

      - name: Run rubocop
        run: bundle exec rubocop
