Repository navigation
MOPS-113: hold workflow changes while a release runs - #8
Conversation
A release's own token cannot tag a commit whose workflow files differ from the default branch's, so a workflow change that merges mid-release leaves it published and untagged. release-freeze keeps a commit status of that name on pull requests: a release fails it on the open ones that change a workflow file when it starts and passes it when it ends, and CI sets it on every pull request push. No credential beyond the workflow's token.
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f229130194
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| freeze: | ||
| needs: preflight |
There was a problem hiding this comment.
Make publishing depend on a successful freeze
In the release workflow template, freeze depends on preflight, but neither verify, publish, nor release depends on freeze. Consequently, publishing can begin while the freeze is still being applied, and a failed freeze does not stop publishing or tagging at all. If status posting fails or a workflow-changing PR merges before its status is updated, the release can still end up published but untagged—the failure this change is intended to prevent. Make successful freezing a prerequisite of the publishing path.
Useful? React with 👍 / 👎.
| thaw: | ||
| needs: [freeze, release] | ||
| if: always() |
There was a problem hiding this comment.
Re-establish the freeze when retrying failed release jobs
If publish fails, this unconditional thaw succeeds and clears the freeze. Following the documented recovery instruction to re-run failed jobs then retries publishing without rerunning the already-successful freeze job. GitHub documents that these retries include dependent jobs, not successful prerequisite jobs. Existing workflow-changing PRs therefore remain green throughout the retry and can merge before tagging. Ensure the freeze is reapplied on publishing retries, or change the supported recovery procedure so it necessarily reruns the freeze.
Useful? React with 👍 / 👎.
| if (mode === "pull-request") { | ||
| await set(pull, (await changesWorkflows(api, pull.number)) && (await releaseRunning(api, { workflow, branch }))); | ||
| return { frozen, thawed }; |
There was a problem hiding this comment.
Prevent PR checks from restoring the freeze after thawing
If a PR's freeze check runs after mode: end has posted success but before the release workflow finishes, this query still sees that release as in_progress and posts failure again. The release's thaw has already processed the PR, so nothing clears the new failure after the run completes; a required release-freeze status leaves the PR blocked until another check or release updates it. This also affects PRs opened during the final thaw job. Coordinate PR checks with an explicit thawed state or perform reconciliation after workflow completion rather than treating every in-progress run as still frozen.
Useful? React with 👍 / 👎.
Why
Releases use only the workflow's own token (owner decision). GitHub refuses that token when it tags a commit whose workflow files differ from the default branch's. A workflow change that merges while a release runs therefore leaves the release published and untagged. On Talaria this happened on the first real release under the contract: a three-hour run, 40 merges, two workflow files changed. The owner chose to block such merges.
What
A new shared action,
release-freeze, and contract rule 6. It keeps a commit status namedrelease-freezeon pull requests:mode: start, a release's first job: fails the status on every open pull request that changes a file under.github/workflows/.mode: end, a last job withif: always(): passes it again, however the release ended. It leaves the freeze in place while another release is still running.mode: pull-request, in CI on every pull request: sets that pull request's own status, so one opened or pushed during a release is caught, and every pull request carries the status so it can be a required check.A check that only ran at push time would not do: a release can start after it passed. Hence the status the release flips.
Needs
statuses: write,pull-requests: read,actions: readfrom the workflow's own token. No new credential. Agents merge on green checks, so a failing status stops them; making GitHub refuse the merge for a person needsrelease-freezelisted as a required check, which is a repository setting.Out of scope: direct pushes to the default branch, and pull requests from forks (their token cannot post a status).
Tests
node --test: one new test covers a release freezing only the pull requests that change a workflow file, thawing them at the end, keeping the freeze while a second release runs, a pull request's own push during and outside a release, one that changes no workflow file, and a renamed workflow file.