🔧 Fix beta-release pushing to main instead of develop - #244
Merged
Conversation
The workflow_run trigger set the job's GITHUB_REF to the workflow file's ref (main, the repo's default branch) instead of the branch that actually triggered it (develop), even though the checkout step explicitly checks out develop's commit. semantic-release's branch detection (env-ci) reads only GITHUB_REF, so it decided it was releasing from main, computed a stable 1.3.0 instead of a beta prerelease, and tried to push straight to main — which branch protection correctly rejected (GH006). This job's `if:` guard already restricts it to develop in both trigger paths, so hardcoding GITHUB_REF here is always correct.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
mainbranch instead ofdevelopRoot cause
The
Beta Releaseworkflow moved fromon: pushtoon: workflow_run(workflows: [CI]) in034e504so releases only happen after CI passes. That introduced a regression: for aworkflow_runevent,GITHUB_REFis the ref of the workflow file (the repo's default branch,main) rather than the branch that triggered the run (develop) — even though the job's checkout step explicitly checks outdevelop's commit viagithub.event.workflow_run.head_sha.semantic-release's CI-environment detection (env-ci's GitHub Actions provider) determines the release branch purely fromGITHUB_REF:So every run since
034e504has silently believed it was releasing frommain, computed a stable version instead of adevelopbeta prerelease, and tried to push straight tomain:This stayed latent because there was no successful
push-triggered CI run ondevelopbetween034e504(2026-08-08) and today —develop's own CI was blocked by the (now separately fixed)extract-zipaudit gate. The first two times a develop CI run actually succeeded today, this surfaced.The fix
Force
GITHUB_REF(andGITHUB_REF_NAME) todevelopin the "Release Beta" step'senv:. The job'sif:guard already restricts both trigger paths (workflow_runandworkflow_dispatch) todevelop, so this is always correct — it just corrects whatenv-cisees.Testing
Run automated release from branch main,git push --tags ... HEAD:main,GH006) that this is the exact failure mode.semantic-release's git push locally against branch protection; recommend watching the nextBeta Releaserun after this merges to confirm it now logs "Run automated release from branch develop" and pushes/tags againstdevelop.Merge Request:
origin/fix/beta-release-branch-detection→origin/develop