2323 strategy :
2424 matrix :
2525 ref :
26- - main
26+ - nightly
2727 - current
2828 - lts/*
2929 - lts/-1
@@ -38,32 +38,26 @@ jobs:
3838 - name : Environment Information
3939 run : npx envinfo
4040
41- # checkout main & build
42- - name : Checkout ${{ matrix.ref }} branch
43- if : matrix.ref == 'main'
44- uses : actions/checkout@v3
45- with :
46- ref : ${{ matrix.ref }}
47- persist-credentials : false
48- - name : Build Node.js
49- if : matrix.ref == 'main'
50- run : make build-ci -j2 V=1 CONFIG_FLAGS="--error-on-warn"
51-
5241 # or install a version and checkout
42+ - name : Get latest nightly
43+ if : matrix.ref == 'nightly'
44+ run : echo "NIGHTLY=$(curl -s https://nodejs.org/download/nightly/index.json | jq -r '.[0].version')" >> $GITHUB_ENV
45+ - name : Get nightly ref
46+ if : matrix.ref == 'nightly'
47+ run : |
48+ SHORT_SHA=$(node -p 'process.env.NIGHTLY.split(/-nightly\d{8}/)[1]')
49+ echo "NIGHTLY_REF=$(gh api /repos/nodejs/node/commits/$SHORT_SHA | jq -r '.sha')" >> $GITHUB_ENV
5350 - name : Install Node.js
54- if : matrix.ref != 'main'
5551 id : setup-node
5652 uses : actions/setup-node@v3
5753 with :
58- node-version : ${{ matrix.ref }}
54+ node-version : ${{ env.NIGHTLY || matrix.ref }}
5955 - name : Checkout ${{ steps.setup-node.outputs.node-version }}
6056 uses : actions/checkout@v3
61- if : matrix.ref != 'main'
6257 with :
6358 persist-credentials : false
64- ref : ${{ steps.setup-node.outputs.node-version }}
59+ ref : ${{ env.NIGHTLY_REF || steps.setup-node.outputs.node-version }}
6560 - name : Set env.NODE
66- if : matrix.ref != 'main'
6761 run : echo "NODE=$(which node)" >> $GITHUB_ENV
6862
6963 # replace checked out WPT with the synchronized branch
0 commit comments