@@ -26,24 +26,27 @@ jobs:
2626 - name : Setup Node.js
2727 uses : ./.github/actions
2828
29- - name : Determine base branch for NX affected
30- id : set-base
29+ - name : Debug mainBranch value
30+ run : |
31+ echo "Input mainBranch: '${{ github.event.inputs.mainBranch }}'"
32+
33+ - name : Determine base for NX affected (if not master)
34+ if : ${{ github.event.inputs.mainBranch != 'master' }}
3135 shell : bash
3236 run : |
33- if [ "${{ github.event.inputs.mainBranch }}" = "master" ]; then
34- echo "base=master" >> $GITHUB_OUTPUT
35- echo "Using base branch 'master'"
36- else
37- LAST_TAG=$(git describe --tags --abbrev=0)
38- LAST_TAG_HASH=$(git rev-parse "$LAST_TAG")
39- echo "base=$LAST_TAG_HASH" >> $GITHUB_OUTPUT
40- echo "Using last tag hash: $LAST_TAG_HASH"
41- fi
42-
43- - name : Derive appropriate SHAs for base and head for `nx affected` commands
37+ LAST_TAG=$(git describe --tags --abbrev=0)
38+ LAST_TAG_HASH=$(git rev-parse "$LAST_TAG")
39+ CURRENT_COMMIT=$(git rev-parse HEAD)
40+ echo "Using last tag hash as NX_BASE: $LAST_TAG_HASH"
41+ echo "Using current commit as NX_HEAD: $CURRENT_COMMIT"
42+ echo "NX_BASE=$LAST_TAG_HASH" >> $GITHUB_ENV
43+ echo "NX_HEAD=$CURRENT_COMMIT" >> $GITHUB_ENV
44+
45+ - name : Determine base for NX affected (if master)
46+ if : ${{ github.event.inputs.mainBranch == 'master' }}
4447 uses : nrwl/nx-set-shas@v4
4548 with :
46- main-branch-name : ${{ steps.set-base.outputs.base }}
49+ main-branch-name : ${{ github.event.inputs.mainBranch }}
4750
4851 - name : Test
4952 run : npx nx affected --target=test --parallel=3 --passWithNoTests --exclude='*,!tag:type:publish'
0 commit comments