Skip to content

Commit 1ede03a

Browse files
committed
Implement simultaneous PR checks for Node.js v20, v24.
Copied from #2006.
1 parent 2e5f63f commit 1ede03a

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

.github/workflows/pr-checks.yml

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ jobs:
2020
fail-fast: false
2121
matrix:
2222
os: [ubuntu-latest, macos-latest, windows-latest]
23+
node-version: [20, 24]
2324
permissions:
2425
contents: read
2526
security-events: write # needed to upload ESLint results
@@ -36,7 +37,7 @@ jobs:
3637
- name: Set up Node.js
3738
uses: actions/setup-node@v5
3839
with:
39-
node-version: 24
40+
node-version: ${{ matrix.node-version }}
4041
cache: 'npm'
4142

4243
- name: Set up Python
@@ -51,6 +52,24 @@ jobs:
5152
npm config set script-shell bash
5253
npm ci
5354
55+
- name: Downgrade @types/node dependency to v20
56+
if: matrix.node-version == 20
57+
run: |
58+
contents=$(jq '.devDependencies."@types/node" = "^20.0.0"' package.json)
59+
echo "${contents}" > package.json
60+
# Usually we run `npm install` on macOS to ensure that we pick up macOS-only dependencies.
61+
# However we're not checking in the updated lockfile here, so it's fine to run
62+
# `npm install` on Linux.
63+
npm install
64+
65+
if [ ! -z "$(git status --porcelain)" ]; then
66+
git config --global user.email "[email protected]"
67+
git config --global user.name "github-actions[bot]"
68+
# The period in `git add --all .` ensures that we stage deleted files too.
69+
git add --all .
70+
git commit -m "Use @types/node=v20"
71+
fi
72+
5473
- name: Verify compiled JS up to date
5574
run: .github/workflows/script/check-js.sh
5675

@@ -70,7 +89,7 @@ jobs:
7089

7190
- name: Upload sarif
7291
uses: github/codeql-action/upload-sarif@v3
73-
if: matrix.os == 'ubuntu-latest'
92+
if: matrix.os == 'ubuntu-latest' && matrix.node-version == 24
7493
with:
7594
sarif_file: eslint.sarif
7695
category: eslint

0 commit comments

Comments
 (0)