Skip to content

Commit ddfd7e9

Browse files
committed
Fetch base ref explicitly in test jobs for targeted diff
fetch-depth: 0 fetches the PR branch history but the base SHA may not be reachable. Explicitly fetch the base ref so the diff works. Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
1 parent 435625f commit ddfd7e9

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

.github/workflows/build-common.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,10 @@ jobs:
314314
# Need history for determine-affected-tests.sh to diff against base
315315
fetch-depth: ${{ needs.determine-affected.outputs.build-scope == 'TARGETED' && 0 || 1 }}
316316

317+
- name: Fetch base ref for targeted diff
318+
if: ${{ needs.determine-affected.outputs.build-scope == 'TARGETED' }}
319+
run: git fetch origin "${{ inputs.pr-base-sha }}"
320+
317321
- name: Free disk space
318322
run: .github/scripts/gha-free-disk-space.sh
319323

.github/workflows/reusable-test-latest-deps.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ jobs:
6161
with:
6262
fetch-depth: ${{ needs.determine-affected.outputs.build-scope == 'TARGETED' && 0 || 1 }}
6363

64+
- name: Fetch base ref for targeted diff
65+
if: ${{ needs.determine-affected.outputs.build-scope == 'TARGETED' }}
66+
run: git fetch origin "${{ inputs.pr-base-sha }}"
67+
6468
- name: Free disk space
6569
run: .github/scripts/gha-free-disk-space.sh
6670

0 commit comments

Comments
 (0)