Skip to content

Commit 0a374f4

Browse files
authored
fix: checkout missing in workflow-variables job causes promote-branch to always attempt branch creation (#205)
The `workflow-variables` job in `promote-branch.yml` had no `actions/checkout` step, so `origin` was never configured as a git remote. `git ls-remote --exit-code --heads origin <target-branch>` always failed (exit non-zero), and with `set +e` the error was swallowed — resulting in `target-branch-exists` always being `false`. The `promote-branch` job then unconditionally tried to create the target branch from `origin/main`, which was rejected as a non-fast-forward push when the branch already existed ahead of `main`. ## Changes - **`.github/workflows/promote-branch.yml`**: Add `actions/checkout@v6` as the first step in `workflow-variables` so `origin` is configured before `git ls-remote` runs, enabling the `target-branch-exists` guard to work correctly.
1 parent 6b1acec commit 0a374f4

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

.github/workflows/promote-branch.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ jobs:
6060
target-branch-exists: ${{ steps.check-target-branch-exists.outputs.target-branch-exists }}
6161
pull-request-exists: ${{ steps.check-pull-request-exists.outputs.pull-request-exists }}
6262
steps:
63+
- name: 'Checkout ${{ github.head_ref || github.ref }}'
64+
uses: actions/checkout@v6
6365
- name: 'Set target branch'
6466
id: set-target-branch
6567
run: |

0 commit comments

Comments
 (0)