1010 secrets :
1111 NX_CLOUD_ACCESS_TOKEN :
1212 required : true
13+ GIST_SECRET :
14+ required : true
15+ GIST_ID :
16+ required : true
1317env :
1418 NX_CLOUD_ACCESS_TOKEN : ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
19+ GIST_SECRET : ${{ secrets.GIST_SECRET }}
20+ GIST_ID : ${{ secrets.GIST_ID }}
1521
1622jobs :
1723 test :
@@ -25,29 +31,23 @@ jobs:
2531 - name : Setup Node.js
2632 uses : ./.github/actions
2733
28- - name : Determine base branch for NX affected
29- id : set-base
34+ - name : Determine base for NX affected (if not master)
35+ if : ${{ inputs.mainBranch != 'master' }}
3036 shell : bash
3137 run : |
32- if [ "${{ github.event.inputs.mainBranch }}" = "master" ]; then
33- echo "base=master" >> $GITHUB_OUTPUT
34- echo "Using base branch 'master'"
35- else
36- LAST_TAG=$(git describe --tags --abbrev=0)
37- LAST_TAG_HASH=$(git rev-parse "$LAST_TAG")
38- echo "base=$LAST_TAG_HASH" >> $GITHUB_OUTPUT
39- echo "Using last tag hash: $LAST_TAG_HASH"
40- fi
38+ LAST_TAG=$(git describe --tags --abbrev=0)
39+ LAST_TAG_HASH=$(git rev-parse "$LAST_TAG")
40+ CURRENT_COMMIT=$(git rev-parse HEAD)
41+ echo "Using last tag hash as NX_BASE: $LAST_TAG_HASH"
42+ echo "Using current commit as NX_HEAD: $CURRENT_COMMIT"
43+ echo "NX_BASE=$LAST_TAG_HASH" >> $GITHUB_ENV
44+ echo "NX_HEAD=$CURRENT_COMMIT" >> $GITHUB_ENV
4145
42- - name : Derive appropriate SHAs for base and head for `nx affected` commands
46+ - name : Determine base for NX affected (if master)
47+ if : ${{ inputs.mainBranch == 'master' }}
4348 uses : nrwl/nx-set-shas@v4
4449 with :
45- main-branch-name : ${{ steps.set-base.outputs.base }}
46-
47- - name : Set GIST_SECRET to env
48- run : |
49- echo "GIST_SECRET=${{ secrets.GIST_SECRET }}" >> $GITHUB_ENV
50- echo "GIST_ID=${{ secrets.GIST_ID }}" >> $GITHUB_ENV
50+ main-branch-name : ${{ inputs.mainBranch }}
5151
5252 - name : Upload test coverage badge
5353 run : npx nx affected --target=upload-badge --passWithNoTests --exclude='*,!tag:type:publish'
0 commit comments