Skip to content

Commit 6847c9a

Browse files
authored
fix: fetch target branch before gh pr create --fill in promote-branch workflow (#206)
`gh pr create --fill` computes the PR body by running `git log origin/<target>...HEAD`, but the shallow checkout (`fetch-depth: 1`) only fetches the source branch. With `origin/<target>` absent from the local repo, git fails with "ambiguous argument" and the job exits non-zero. ## Changes - **`.github/workflows/promote-branch.yml`** — add `git fetch origin ${{ env.target-branch }}` immediately before `gh pr create` in the "Create PR" step, ensuring the remote tracking ref exists when `--fill` computes the commit range.
1 parent 0a374f4 commit 6847c9a

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

.github/workflows/promote-branch.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,4 +220,5 @@ jobs:
220220
current-branch: ${{ github.ref_name }}
221221
target-branch: ${{ needs.workflow-variables.outputs.target-branch }}
222222
run: |
223+
git fetch origin ${{ env.target-branch }}
223224
gh pr create --title "Promote ${{ env.current-branch }} to ${{ env.target-branch }}" --fill --base ${{ env.target-branch }} --head ${{ env.current-branch }}

0 commit comments

Comments
 (0)