10
10
secrets :
11
11
NX_CLOUD_ACCESS_TOKEN :
12
12
required : true
13
+ GIST_SECRET :
14
+ required : true
15
+ GIST_ID :
16
+ required : true
13
17
env :
14
18
NX_CLOUD_ACCESS_TOKEN : ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
19
+ GIST_SECRET : ${{ secrets.GIST_SECRET }}
20
+ GIST_ID : ${{ secrets.GIST_ID }}
15
21
16
22
jobs :
17
23
test :
@@ -25,29 +31,23 @@ jobs:
25
31
- name : Setup Node.js
26
32
uses : ./.github/actions
27
33
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' }}
30
36
shell : bash
31
37
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
41
45
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' }}
43
48
uses : nrwl/nx-set-shas@v4
44
49
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 }}
51
51
52
52
- name : Upload test coverage badge
53
53
run : npx nx affected --target=upload-badge --passWithNoTests --exclude='*,!tag:type:publish'
0 commit comments