2323 strategy :
2424 matrix :
2525 ref :
26- - main
26+ - nightly
2727 - current
2828 - lts/*
2929 - lts/-1
@@ -38,32 +38,28 @@ 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+ env :
48+ GH_TOKEN : ${{ github.token }}
49+ run : |
50+ SHORT_SHA=$(node -p 'process.env.NIGHTLY.split(/-nightly\d{8}/)[1]')
51+ echo "NIGHTLY_REF=$(gh api /repos/nodejs/node/commits/$SHORT_SHA | jq -r '.sha')" >> $GITHUB_ENV
5352 - name : Install Node.js
54- if : matrix.ref != 'main'
5553 id : setup-node
5654 uses : actions/setup-node@v3
5755 with :
58- node-version : ${{ matrix.ref }}
56+ node-version : ${{ env.NIGHTLY || matrix.ref }}
5957 - name : Checkout ${{ steps.setup-node.outputs.node-version }}
6058 uses : actions/checkout@v3
61- if : matrix.ref != 'main'
6259 with :
6360 persist-credentials : false
64- ref : ${{ steps.setup-node.outputs.node-version }}
61+ ref : ${{ env.NIGHTLY_REF || steps.setup-node.outputs.node-version }}
6562 - name : Set env.NODE
66- if : matrix.ref != 'main'
6763 run : echo "NODE=$(which node)" >> $GITHUB_ENV
6864
6965 # replace checked out WPT with the synchronized branch
0 commit comments