Run every linter separately in Github Actions
The main reason for this change is that Pronto doesn't run in pull requests opened by external contributors, and we haven't found how to fix this issue. Another reason is that Pronto only detects issues in the lines where the changes are done, but sometimes we introduce issues related to other lines and those aren't detected by Pronto. Also, when adding or changing Rubocop rules, or when we update Rubocop, Pronto doesn't check whether those rules are applied in every Ruby and ERB file, and we sometimes forget to do so (particularly in ERB files). So, from now, the linters will check all the code in every pull request. Note we're now excluding the `vendor` folder in our linters because the `setup-ruby` action actions generates a `vendor/bundle/` folder with all our gem dependencies, and we don't want to check those files.
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
---
|
---
|
||||||
EnableDefaultLinters: false
|
EnableDefaultLinters: false
|
||||||
|
exclude:
|
||||||
|
- '**/vendor/**/*'
|
||||||
linters:
|
linters:
|
||||||
AllowedScriptType:
|
AllowedScriptType:
|
||||||
enabled: true
|
enabled: true
|
||||||
|
|||||||
40
.github/workflows/linters.yml
vendored
Normal file
40
.github/workflows/linters.yml
vendored
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
name: linters
|
||||||
|
on: [pull_request]
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
linters:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- name: RuboCop
|
||||||
|
run: bundle exec rubocop --fail-level convention --display-only-fail-level-offenses -f github
|
||||||
|
- name: ERB Lint
|
||||||
|
run: bundle exec erblint .
|
||||||
|
- name: ESLint
|
||||||
|
run: npx eslint . --quiet
|
||||||
|
- name: Stylelint
|
||||||
|
run: npx stylelint app/assets/stylesheets
|
||||||
|
name: ${{ matrix.name }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- run: |
|
||||||
|
git fetch --no-tags --prune origin +refs/heads/*:refs/remotes/origin/*
|
||||||
|
- name: Setup Ruby
|
||||||
|
uses: ruby/setup-ruby@v1
|
||||||
|
with:
|
||||||
|
bundler-cache: true
|
||||||
|
- name: Setup NPM
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
cache: "npm"
|
||||||
|
node-version-file: ".node-version"
|
||||||
|
- name: Install node packages
|
||||||
|
run: npm clean-install
|
||||||
|
- name: ${{ matrix.name }}
|
||||||
|
run: ${{ matrix.run }}
|
||||||
8
.github/workflows/pronto.yml
vendored
8
.github/workflows/pronto.yml
vendored
@@ -4,6 +4,7 @@ on: [pull_request]
|
|||||||
jobs:
|
jobs:
|
||||||
pronto:
|
pronto:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
if: github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name && github.actor != 'dependabot'
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
@@ -21,9 +22,4 @@ jobs:
|
|||||||
- name: Install node packages
|
- name: Install node packages
|
||||||
run: npm clean-install
|
run: npm clean-install
|
||||||
- name: Run pronto
|
- name: Run pronto
|
||||||
run: |
|
run: PRONTO_PULL_REQUEST_ID="$(jq --raw-output .number "$GITHUB_EVENT_PATH")" PRONTO_GITHUB_ACCESS_TOKEN="${{ github.token }}" bundle exec pronto run -f github_status github_pr -c origin/${{ github.base_ref }}
|
||||||
if [[ ${{ github.event.pull_request.head.repo.full_name }} == ${{ github.event.pull_request.base.repo.full_name }} && ${{ github.actor }} != dependabot ]]; then
|
|
||||||
PRONTO_PULL_REQUEST_ID="$(jq --raw-output .number "$GITHUB_EVENT_PATH")" PRONTO_GITHUB_ACCESS_TOKEN="${{ github.token }}" bundle exec pronto run -f github_status github_pr -c origin/${{ github.base_ref }}
|
|
||||||
else
|
|
||||||
bundle exec pronto run --exit-code -c origin/${{ github.base_ref }}
|
|
||||||
fi
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ AllCops:
|
|||||||
Exclude:
|
Exclude:
|
||||||
- "db/schema.rb"
|
- "db/schema.rb"
|
||||||
- "app/lib/ckeditor/backend/active_storage.rb"
|
- "app/lib/ckeditor/backend/active_storage.rb"
|
||||||
|
- "vendor/**/*"
|
||||||
DisabledByDefault: true
|
DisabledByDefault: true
|
||||||
|
|
||||||
Bundler/DuplicatedGem:
|
Bundler/DuplicatedGem:
|
||||||
|
|||||||
Reference in New Issue
Block a user