fix(ci): checkout branch ref to avoid detached HEAD in release#92
fix(ci): checkout branch ref to avoid detached HEAD in release#92
Conversation
python-semantic-release v10 refuses to run in detached HEAD state, causing the Release workflow to silently skip all releases. Switch checkout ref from head_sha to head_branch so Git lands on the branch rather than a detached commit. Add a verification step to confirm HEAD still matches the CI-tested SHA, preserving the security intent. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
📝 WalkthroughWalkthroughThe PR updates the release workflow to use branch references instead of commit SHA during checkout, adds SHA verification logic to ensure correctness, and changes the commitlint invocation in the commit message hook to explicitly use the lint subcommand. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@scripts/commit-msg`:
- Line 5: In the commit hook script there is an incorrect commitlint invocation:
replace the current invocation that includes the extra "lint" subcommand (the
line that runs poetry run commitlint lint --file "$1") with the correct CLI
usage that omits "lint" so the script runs commitlint with the --file argument
(i.e., use poetry run commitlint --file "$1"). This change fixes the hook so
commitlint validates the file contents instead of treating "lint" as the commit
message.
The previous commit inadvertently included a change to scripts/commit-msg that added an incorrect "lint" subcommand. The Python commitlint (1.13.3) uses commitlint --file FILE directly; no subcommand is needed. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Summary
python-semantic-releasev10 refuses to run in detached HEAD state, loggingDetached HEAD state cannot match any release groups; no release will be maderef: head_sha(a SHA always produces detached HEAD) instead of the branch nameref: head_branchso Git checks out on the named branch, then verify HEAD still equals the CI-tested SHA to preserve the security guaranteeChanges
.github/workflows/release.yml: checkout by branch name + add SHA verification stepTest plan
feat:orfix:commit to main and confirm the Release workflow runs to completion (PSR bumps version, creates tag, triggers publish jobs)head_branchto a branch ahead ofhead_sha)🤖 Generated with Claude Code
Summary by CodeRabbit