ci(release): allow optional branch argument (defaults to main)#239
Conversation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Pull request overview
Adds a branch parameter to the manual release workflow so releases (tests + tag creation) can be cut from non-main branches, with a pre-flight branch existence check and updated release documentation.
Changes:
- Add
branchinput (defaultmain) plus avalidate-branchjob to fail fast on invalid branches. - Check out
ref: ${{ inputs.branch }}intestandbuildso the release targets the chosen branch tip. - Document the new branch input and a hotfix release example in
RELEASING.md(plus new superpowers spec/plan artifacts).
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
.github/workflows/release.yml |
Adds branch input + validate job; wires checkout ref for test/build; gates license-check on validation. |
RELEASING.md |
Documents optional branch input and hotfix release instructions + updated job graph. |
superpowers/specs/2026-07-21-itl-545-release-branch-argument-design.md |
Captures the approved design for the optional branch workflow input and validation approach. |
superpowers/plans/2026-07-21-itl-545-release-branch-argument.md |
Implementation plan/checklist for making the workflow + docs changes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| run: | | ||
| if ! gh api "repos/${{ github.repository }}/branches/${BRANCH}" --silent 2>/dev/null; then | ||
| echo "::error::Branch '${BRANCH}' does not exist. Check for typos." | ||
| exit 1 | ||
| fi | ||
| echo "Branch '${BRANCH}' confirmed." |
There was a problem hiding this comment.
Fixed in 255d054. Added ENCODED_BRANCH="${BRANCH//\//%2F}" in the run: script and switched the gh api call to use ${ENCODED_BRANCH} in the URL path. The error message still shows the original ${BRANCH} value so it's readable to the user. This handles branch names like hotfix/0.1.x correctly.
| license-check: | ||
| needs: [validate-branch] | ||
| uses: ./.github/workflows/_license-check.yml |
There was a problem hiding this comment.
This limitation was explicitly acknowledged in the design spec and scoped out: the license check validates installed dependencies (from pyproject.toml/uv.lock), not branch-specific source, so running it against the dispatch ref is considered acceptable for this workflow. The _license-check.yml reusable workflow has no workflow_call inputs, so it cannot receive a ref without a more involved interface change — that's a separate piece of work. Leaving as-is per the original design decision.
There was a problem hiding this comment.
Why not address this change in this issue?
There was a problem hiding this comment.
Fixed in 492530e. Added a branch input (default main) to _license-check.yml's workflow_call trigger and wired ref: ${{ inputs.branch }} into its checkout step. The license-check job in release.yml now passes with: branch: ${{ inputs.branch }} through to the reusable workflow.
| To release from a branch other than `main` — for example, a maintenance branch carrying | ||
| a critical patch — enter the branch name in the **Branch** field when triggering the | ||
| workflow. |
There was a problem hiding this comment.
Fixed in 255d054. Added a step 2 to the hotfix example explicitly calling out that the Use workflow from dropdown should remain on main (not hotfix/0.1.x), so the workflow version with the Branch field is used.
… dropdown in docs
Review round summary (commit 255d054)Three comments addressed: Fixed — URL encoding for branch names with Fixed — "Use workflow from" dropdown clarification in RELEASING.md Not changed — |
Review round summary (commit 492530e)One change addressed: Fixed —
|
Summary
branchinput to therelease.ymlworkflow dispatch (defaults tomain) — omitting it is identical to today's behaviorvalidate-branchpre-flight job that calls the GitHub API to verify the branch exists before tests or any state-creating steps run; usesBRANCHenv var (not inline template expression) to prevent script injectionref: ${{ inputs.branch }}into thetestandbuildcheckout steps so tests and tag creation target the release branch tipRELEASING.mdwith the new parameter, updated job-graph diagram, and a concrete hotfix-release example (hotfix/0.1.x→v0.1.1)Closes ITL-545
Test plan
main)mainbranch — confirm the tag is created at that branch's tipvalidate-branchfails immediately withBranch '...' does not exist. Check for typos.and no other jobs start