Skip to content

Commit 6f6fc2f

Browse files
committed
fix: fetch main into a local branch ref, not just FETCH_HEAD
git fetch origin main only populates FETCH_HEAD, which turbo's --affected merge-base lookup can't resolve as 'main'. Fetch directly into a local main branch ref instead.
1 parent 8145a73 commit 6f6fc2f

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

.github/actions/build-packages/action.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,13 @@ runs:
1515
run: pnpm build --continue
1616

1717
# Checkout pins `ref` to the PR head SHA, so it only fetches that commit's
18-
# history — `main` never becomes a resolvable ref locally, which breaks
19-
# turbo's `--affected` merge-base lookup unless we fetch it explicitly.
18+
# history — `main` never becomes a resolvable ref locally. `git fetch`
19+
# alone only populates FETCH_HEAD, so fetch straight into a local branch
20+
# ref, which is what turbo's merge-base lookup requires.
2021
- name: Fetch main for affected detection
2122
if: ${{ inputs.only-affected == 'true' }}
2223
shell: bash
23-
run: git fetch origin main
24+
run: git fetch origin main:main
2425

2526
- name: Build project [affected]
2627
if: ${{ inputs.only-affected == 'true' }}

0 commit comments

Comments
 (0)