Skip to content

Commit 5e0d889

Browse files
fix(ci): unbreak hotfix-release semantic-release run (#1091)
The Checkout step used `ref: github.event.pull_request.head.sha`, which puts git in detached HEAD. python-semantic-release v10.5.3 then bails with "Detached HEAD state cannot match any release groups; no release will be made" because it can't match the current branch against pyproject.toml's `[tool.semantic_release].branch = "master"` config. The release silently no-ops, no tag is cut, and the downstream build/addon-publish jobs are skipped — which is what happened on the merge of #1090: stable was never advanced past v7.4.0 and v7.4.1 was never built. The original "avoid the merge commit" intent also caused a second latent bug: the PR head SHA isn't on master's first-parent history, so the workflow's later `git push origin HEAD:master` would have been non-fast-forward even if semantic-release had worked. Switch the checkout to `pull_request.merge_commit_sha` (the merge result that's actually on master) and attach to a local `master` branch so semantic-release matches its branch group. The downstream push then fast-forwards as intended. Co-authored-by: kingpanther13 <kingpanther13@users.noreply.github.com>
1 parent 690196c commit 5e0d889

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

.github/workflows/hotfix-release.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,22 @@ jobs:
2828
issues: write
2929

3030
steps:
31-
- name: Checkout hotfix branch commit
31+
- name: Checkout merged hotfix on master
3232
uses: actions/checkout@v6
3333
with:
34-
# Checkout the original hotfix commit, not the merge commit
35-
ref: ${{ github.event.pull_request.head.sha }}
34+
# Check out the merge commit so the workspace matches master's history;
35+
# then attach to a local master branch below. python-semantic-release
36+
# matches the active branch against [tool.semantic_release].branch
37+
# in pyproject.toml — a detached HEAD checkout (e.g., of head.sha)
38+
# fails silently with "Detached HEAD state cannot match any release
39+
# groups; no release will be made", which is what broke PR #1090.
40+
ref: ${{ github.event.pull_request.merge_commit_sha }}
3641
fetch-depth: 0
3742
token: ${{ secrets.GITHUB_TOKEN }}
3843

44+
- name: Attach to master branch locally
45+
run: git checkout -B master HEAD
46+
3947
- name: Validate hotfix is based on stable
4048
run: |
4149
# Get the stable tag (moving tag that points to latest stable)

0 commit comments

Comments
 (0)