Skip to content

Commit 70ecb44

Browse files
committed
chore: fix commit selection in workflow
1 parent 8d746cc commit 70ecb44

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

.github/workflows/test.yml

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,19 @@ jobs:
2727
node-version: 18
2828
- name: Install
2929
run: npm ci
30-
# Defaults for base and head commits are okay for PRs but
31-
# for pushed commits to main we should take as base the commit before
30+
# Set the right values for base and head commits depending
31+
# on the type of event (PR or push)
3232
# ref: https://nx.dev/ci/features/affected#configure-affected-on-ci
33-
- name: Set base and head commits (Push)
33+
- name: Set base and head commits
3434
if: ${{ github.event_name == 'push' }}
3535
run: |
36-
export NX_BASE=origin/main~1
37-
export NX_HEAD=origin/main
36+
if [ "${{github.event_name}}" == "push" ] then
37+
export NX_BASE=origin/main~1
38+
export NX_HEAD=origin/main
39+
else
40+
export NX_BASE=origin/main
41+
export NX_HEAD=HEAD
42+
fi
3843
- name: Compile (Delta)
3944
run: npm run compile:ci:affected
4045
- name: Upload Build Artifacts
@@ -198,11 +203,16 @@ jobs:
198203
name: compile-cache-${{ github.run_number }}
199204
path: .nx
200205
# See comment in the compile job
201-
- name: Set base and head commits (Push)
206+
- name: Set base and head commits
202207
if: ${{ github.event_name == 'push' }}
203208
run: |
204-
export NX_BASE=origin/main~1
205-
export NX_HEAD=origin/main
209+
if [ "${{github.event_name}}" == "push" ] then
210+
export NX_BASE=origin/main~1
211+
export NX_HEAD=origin/main
212+
else
213+
export NX_BASE=origin/main
214+
export NX_HEAD=HEAD
215+
fi
206216
- name: Compile (Delta)
207217
run: npm run compile:ci:affected
208218
- name: Unit tests (Browser - Delta)

0 commit comments

Comments
 (0)