-
Notifications
You must be signed in to change notification settings - Fork 10
75 lines (64 loc) · 2.59 KB
/
linter.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
name: Linting
# Trigger each time HEAD branch is updated in a pull request
# see https://github.com/orgs/community/discussions/26366
on:
pull_request:
types: [opened, reopened, synchronize, ready_for_review]
jobs:
rubocop:
name: RuboCop (Ruby)
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 2 # to also fetch parent of PR (used to get changed files)
- name: Get changed files
id: rb-changed
uses: ./.github/actions/changed_files/
with:
file-extensions: \.rb$
- name: Set up Ruby 3
if: ${{ steps.rb-changed.outputs.changed-files != ''}}
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.1.4
bundler-cache: true
- name: Run RuboCop
if: ${{ steps.rb-changed.outputs.changed-files != ''}}
run: |
echo "🚨 Running RuboCop version: $(bundle info rubocop | head -1)"
bundle exec rubocop --format github --fail-level 'convention' --force-exclusion -- $CHANGED_FILES
eslint:
name: ESLint (JS)
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 2 # to also fetch parent of PR (used to get changed files)
- name: Get changed files
id: js-changed
uses: ./.github/actions/changed_files/
with:
# .(mjs is only used for eslint.config.mjs as of January 2024)
file-extensions: \.js$|\.mjs$|\.js.erb$
- name: Setup Node.js
if: ${{ steps.js-changed.outputs.changed-files != ''}}
uses: actions/setup-node@v4
with:
node-version: '20' # End of Life (EOL): April 2026
cache: 'yarn'
- name: Install dependencies
if: ${{ steps.js-changed.outputs.changed-files != ''}}
run: yarn install
# with ESLint v9 --ignore-path does not exist anymore
# see [1] for the PR. However, my feeling for this is totally reflected
# by [2]. Hopefully, it will come back in future versions.
# [1] https://github.com/eslint/eslint/pull/16355
# [2] https://github.com/eslint/eslint/issues/16264#issuecomment-1292858747
- name: Run ESLint
if: ${{ steps.js-changed.outputs.changed-files != ''}}
run: |
echo "🚨 Running ESLint version: $(yarn run --silent eslint --version)"
yarn run eslint --config ./.config/eslint.mjs --max-warnings 0 --no-warn-ignored ${{ steps.js-changed.outputs.changed-files }}