2023-02-28 11:11:08 -07:00
|
|
|
name: Ruby
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches: [ "main" ]
|
|
|
|
|
|
|
|
permissions:
|
2023-07-27 18:23:18 -06:00
|
|
|
contents: write
|
2023-07-27 18:24:53 -06:00
|
|
|
pull-requests: write
|
2023-02-28 11:11:08 -07:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
test:
|
|
|
|
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2023-07-27 17:58:27 -06:00
|
|
|
ruby-version: ['3.2']
|
2023-02-28 11:11:08 -07:00
|
|
|
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Set up Ruby
|
|
|
|
uses: ruby/setup-ruby@ee2113536afb7f793eed4ce60e8d3b26db912da4 # v1.127.0
|
|
|
|
with:
|
|
|
|
ruby-version: ${{ matrix.ruby-version }}
|
|
|
|
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
2023-07-27 18:03:15 -06:00
|
|
|
- name: Install Rubocops latest version
|
2023-07-27 18:01:56 -06:00
|
|
|
run: gem install rubocop
|
2023-07-27 18:03:15 -06:00
|
|
|
- name: Run tests
|
2023-07-27 18:06:00 -06:00
|
|
|
run: rubocop -A --fail-level warn
|
2023-07-27 18:10:50 -06:00
|
|
|
- name: Commit changes
|
|
|
|
run: |
|
|
|
|
git config --local user.email "action@github.com"
|
|
|
|
git config --local user.name "GitHub Action"
|
|
|
|
git add -A
|
|
|
|
git commit -m "Apply RuboCop auto-correct" || echo "No changes to commit"
|
|
|
|
- name: Create Pull Request
|
|
|
|
uses: peter-evans/create-pull-request@v3
|
|
|
|
with:
|
2023-07-27 18:12:43 -06:00
|
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
2023-07-27 18:10:50 -06:00
|
|
|
title: "Apply RuboCop auto-correct"
|
|
|
|
branch: "rubocop-autocorrect"
|
|
|
|
delete-branch: true
|
|
|
|
body: "This PR applies RuboCop auto-corrections to the codebase."
|