fix(ci): drop invalid git fetch --depth=0 in Nx base resolution
`actions/checkout@v4` already runs with `fetch-depth: 0`, which pulls every branch and tag — origin/<base_ref> is therefore present locally and the explicit fetch is redundant. The flag value `--depth=0` is itself invalid (git requires a positive integer), so the step failed with `fatal: depth 0 is not a positive number` on every PR run.
This commit is contained in:
@@ -27,8 +27,11 @@ jobs:
|
|||||||
- name: Derive Nx affected base and head
|
- name: Derive Nx affected base and head
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
|
# `actions/checkout@v4` with fetch-depth: 0 already pulls every
|
||||||
|
# branch and tag, so origin/<base_ref> is present locally — no
|
||||||
|
# extra `git fetch` is needed (and `--depth=0` is invalid: git
|
||||||
|
# requires a positive integer).
|
||||||
if [ "${{ github.event_name }}" = "pull_request" ]; then
|
if [ "${{ github.event_name }}" = "pull_request" ]; then
|
||||||
git fetch origin "${{ github.base_ref }}" --depth=0
|
|
||||||
echo "NX_BASE=$(git merge-base HEAD origin/${{ github.base_ref }})" >> "$GITHUB_ENV"
|
echo "NX_BASE=$(git merge-base HEAD origin/${{ github.base_ref }})" >> "$GITHUB_ENV"
|
||||||
else
|
else
|
||||||
echo "NX_BASE=HEAD~1" >> "$GITHUB_ENV"
|
echo "NX_BASE=HEAD~1" >> "$GITHUB_ENV"
|
||||||
|
|||||||
Reference in New Issue
Block a user