You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
gate: a workflow_run release evaluates the default branch tip, not the commit whose CI passed #1099
In a CI-gated immediate release (release.yml triggered by workflow_run on CI), the gate evaluates the wrong commit when main has moved on since the CI run started.
runGate (src/gate/gate.ts) takes the commit from getGitHubContext(), which reads process.env.GITHUB_SHA, and looks up its merged PR with listPullRequestsAssociatedWithCommit. In a workflow_run event, GITHUB_SHA is the latest commit on the default branch, not the commit whose CI run completed (github.event.workflow_run.head_sha). Runner GITHUB_* variables can't be overridden from workflow env, and the action has no input for the commit, so callers can't correct it.
Checking out workflow_run.head_sha before the gate step doesn't help: the gate then reads that commit's files but still evaluates the tip's PR labels.
Impact
Two PRs, A then B, merge before A's CI finishes:
B can release before its own CI passes. A's CI completes first; the gate in that run evaluates the tip (B). If B carries release:immediate, it releases while B's CI is still running. The release itself also runs from the tip of the target branch.
A's labels are never evaluated. Every gate run sees B, so a release:immediate on A is silently dropped. This happens whether A's CI run finishes or is cancelled, so it gets more likely in repos whose CI uses concurrency: cancel-in-progress on the default branch.
The standing-PR publish path isn't affected; it dispatches the release workflow directly.
Proposed fix
Resolve the gate's commit from the event: when GITHUB_EVENT_NAME is workflow_run, read workflow_run.head_sha from GITHUB_EVENT_PATH; otherwise use GITHUB_SHA. An explicit sha action input (passed through as INPUT_SHA) would also let callers override it.
Release from that commit, or refuse when the target branch has moved past it and report why in the summary, instead of releasing the tip. Releasing the verified commit is close to the 0.53.0 theme of publishing the plan the version step recorded; refusing is enough for this issue.
Repro
A repo with ci.releaseStrategy: standing-pr and the documented workflow_run-gated release.yml.
Merge PR A, then PR B (labelled release:immediate) before A's CI completes.
A's CI finishes: the gate reports B's labels and releases B while B's CI is still running.
Activity