Skip to content

Commit 5f957da

Browse files
committed
Move ESlint into it's own workflow
1 parent 01a4a57 commit 5f957da

File tree

2 files changed

+49
-47
lines changed

2 files changed

+49
-47
lines changed

.github/workflows/eslint.yml

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: JS Linting
2+
3+
on:
4+
push:
5+
branches:
6+
- develop
7+
- trunk
8+
paths:
9+
- '**.js'
10+
- '**.json'
11+
pull_request:
12+
branches:
13+
- develop
14+
paths:
15+
- '**.js'
16+
- '**.json'
17+
18+
jobs:
19+
eslint:
20+
runs-on: ubuntu-latest
21+
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v4
25+
26+
- name: Setup node and npm cache
27+
uses: actions/setup-node@v4
28+
with:
29+
node-version-file: .nvmrc
30+
cache: npm
31+
32+
- name: Install Node dependencies
33+
run: npm ci --omit=optional
34+
35+
- name: Get updated JS files
36+
id: changed-files
37+
uses: tj-actions/changed-files@v45
38+
with:
39+
files: |
40+
**/*.js
41+
**/*.json
42+
43+
- name: Run JS linting
44+
run: |
45+
if [[ "${{ steps.changed-files.outputs.any_changed }}" == 'true' && "${{ github.event_name }}" == "pull_request" ]]; then
46+
npx wp-scripts lint-js ${{ steps.changed-files.outputs.all_changed_files }}
47+
elif [[ "${{ github.event_name }}" == "push" ]]; then
48+
npm run lint:js
49+
fi

.github/workflows/lint.yml

-47
This file was deleted.

0 commit comments

Comments
 (0)