Skip to content

release: refuse to release from any branch but main - #5

Merged
sevmorris merged 1 commit into
mainfrom
release-main-gate
Sep 29, 2026
Merged

sevmorris merged 1 commit into
mainfrom
release-main-gate

Conversation

@sevmorris

Copy link
Copy Markdown
Owner

Summary

  • release.sh preflight now stops unless the checked-out branch and the branch the push lands on are both main. A work branch, a branch that merely tracks main, and a detached HEAD are all refused before anything is built or pushed.
  • Ported from WaxOnWaxOff 0ad8fb0. Same code and failure message. The comment differs in one clause: WaxOnWaxOff's says its CI gate would not catch a work-branch release, and this script has no CI gate, so it says instead that nothing else in preflight asks which branch it is releasing from.
  • The upstream-resolution comment above the gate loses its "works from any branch" clause, which the gate makes untrue.

Testing

  • zsh -n release.sh
  • The gate snippet, extracted from this release.sh, run in throwaway repos:
    1. main tracking origin/main: passes
    2. work branch, no upstream: fails
    3. work branch tracking origin/main: fails
    4. detached HEAD: fails
    5. main tracking origin/dev: fails
  • release.sh itself was not run.

🤖 Generated with Claude Code

Work reaches main when the owner merges it, and releases are cut from
main by hand, but nothing enforced the second half. Run from a work
branch, release.sh passed every preflight check and would have
published unmerged code as "latest".

Preflight now fails unless the checked-out branch and the branch the
push lands on are both main. A branch that merely tracks main is
refused too, since its own commits would otherwise be pushed straight
onto it.

Ported from WaxOnWaxOff 0ad8fb0. The code and message are the same;
the comment drops that repo's reference to its CI gate, which this
script does not have.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sevmorris
sevmorris merged commit 85c3fb5 into main Sep 29, 2026
1 check passed
@sevmorris
sevmorris deleted the release-main-gate branch September 29, 2026 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant