File tree Expand file tree Collapse file tree 2 files changed +46
-3
lines changed
Expand file tree Collapse file tree 2 files changed +46
-3
lines changed Original file line number Diff line number Diff line change 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
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
5152 npm config set script-shell bash
5253 npm ci
5354
54- - name : Verify compiled JS up to date
55+ - name : Verify compiled JS up to date (Node.js 20)
56+ if : matrix.node-version == 20
57+ run : .github/workflows/script/check-js-20.sh
58+
59+ - name : Verify compiled JS up to date (Node.js 24)
60+ if : matrix.node-version == 24
5561 run : .github/workflows/script/check-js.sh
5662
5763 - name : Verify PR checks up to date
7379
7480 - name : Upload sarif
7581 uses : github/codeql-action/upload-sarif@v3
76- if : matrix.os == 'ubuntu-latest'
82+ if : matrix.os == 'ubuntu-latest' && matrix.node-version == 24
7783 with :
7884 sarif_file : eslint.sarif
7985 category : eslint
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ set -eu
3+
4+ # Change @types/node to v20 temporarily to check that the generated JS files are correct.
5+ contents=$( jq ' .devDependencies."@types/node" = "^20.0.0"' package.json)
6+ echo " ${contents} " > package.json
7+
8+ npm install
9+
10+ if [ ! -z " $( git status --porcelain) " ]; then
11+ git config --global user.email " github-actions@github.com"
12+ git config --global user.name " github-actions[bot]"
13+ # The period in `git add --all .` ensures that we stage deleted files too.
14+ git add --all .
15+ git commit -m " Use @types/node v20"
16+ fi
17+
18+ # Wipe the lib directory in case there are extra unnecessary files in there
19+ rm -rf lib
20+
21+ # Generate the JavaScript files
22+ npm run-script build
23+
24+ # Check that repo is still clean.
25+ # The downgrade of @types/node means that we expect certain changes to the generated JS files.
26+ # Therefore, we should ignore these changes to @types/node and check for outstanding changes.
27+ if [[ $( git diff | grep --perl-regexp ' ^-(?!--)' | grep --count --invert-match --perl-regexp ' "@types/node": "\^24' ) -gt 0 || \
28+ $( git diff | grep --perl-regexp ' ^\+(?!\+\+)' | grep --count --invert-match --perl-regexp ' "@types/node": "\^20' ) -gt 0 ]]
29+ then
30+ >&2 echo " Failed: JavaScript files are not up to date. Run 'rm -rf lib && npm run-script build' to update"
31+ git diff
32+ exit 1
33+ fi
34+ echo " Success: JavaScript files are up to date"
35+
36+ # Clean up changes to package.json, package-lock.json, and lib/*.js.
37+ git reset --hard HEAD~1
You can’t perform that action at this time.
0 commit comments