Skip to content

Commit 56f2ad6

Browse files
ci(frontend): lint changed files on pull requests (#7748)
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 879046c commit 56f2ad6

1 file changed

Lines changed: 39 additions & 0 deletions

File tree

.github/workflows/frontend-pull-request.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,42 @@ jobs:
3434

3535
- name: Run unit tests
3636
run: npm run test:unit -- --passWithNoTests
37+
38+
lint:
39+
name: Lint changed files
40+
runs-on: ubuntu-latest
41+
42+
defaults:
43+
run:
44+
working-directory: frontend
45+
46+
steps:
47+
- uses: actions/checkout@v5
48+
with:
49+
fetch-depth: 0 # needed to diff against the PR base
50+
51+
- name: Setup Node.js
52+
uses: actions/setup-node@v4
53+
with:
54+
node-version-file: frontend/.nvmrc
55+
cache: npm
56+
cache-dependency-path: frontend/package-lock.json
57+
58+
- name: Install dependencies
59+
run: npm ci
60+
61+
# Diff-scoped: the frontend has a large pre-existing eslint/tsc backlog,
62+
# so a whole-repo gate isn't viable yet.
63+
- name: Lint changed files
64+
env:
65+
BASE_SHA: ${{ github.event.pull_request.base.sha }}
66+
run: |
67+
CHANGED=$(git diff --name-only --diff-filter=ACMR --relative \
68+
"$BASE_SHA" HEAD -- '*.ts' '*.tsx' '*.js')
69+
if [ -z "$CHANGED" ]; then
70+
echo "No frontend JS/TS files changed — skipping."
71+
exit 0
72+
fi
73+
echo "Linting changed files:"
74+
echo "$CHANGED"
75+
echo "$CHANGED" | xargs npx eslint

0 commit comments

Comments
 (0)