Protect the release branch with trunk's settings during code freeze - #4378
Merged
AliSoftware merged 3 commits intoJul 29, 2026
Merged
Conversation
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
mokagio
reviewed
Jul 29, 2026
mokagio
reviewed
Jul 29, 2026
mokagio
approved these changes
Jul 29, 2026
mokagio
left a comment
Contributor
There was a problem hiding this comment.
Only a couple of nitpicks on the comments wording.
wojtekn
approved these changes
Jul 29, 2026
wojtekn
left a comment
Contributor
There was a problem hiding this comment.
Looks like a good improvement.
Co-authored-by: Gio Lodi <giovanni.lodi42@gmail.com> Co-authored-by: Olivier Halligon <olivier@halligon.net>
AliSoftware
enabled auto-merge (squash)
July 29, 2026 14:48
AliSoftware
deleted the
ainfra-2697-protect-release-branch-during-code-freeze
branch
July 29, 2026 14:49
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.
Related Issues
Note
The last part of that issue — about reviewing the wording of the MC pre-release task for release notes — is handled by 230972-ghe-Automattic/wpcom in ReleasesV2.
How AI was used in this PR
Claude Code drafted the changes and the docs, from the Linear issue plus the
copy_branch_protectioncalls we already make in theFastfileof our other mobile repos. It also surfaced thePerformance Metricsgotcha described below by cross-checkingtrunk's live protection settings against theif:guards inpipeline.yml. I reviewed the diff, adjusted the code comments, and made the calls on what to include (see "Not included" below).Why this is needed / What triggered this change
During the
1.15.0release, therelease/1.15.0branch was deleted prematurely — GitHub auto-deletes the head branch of a merged PR, and a backmerge PR ended up with the release branch as its head — which broke the Build Release step until the branch was recreated by hand. Unlike our other repos, Studio never protected its release branches, most likely a leftover from the migration to Buildkite and ReleasesV2, before the code-freeze-driven release process was in place.See p1783940368685129/1783940368.685129-slack-CC7L49W13 for more context.
Proposed Changes
code_freezenow copiestrunk's branch protection onto therelease/*branch it creates, so for the whole life of the release that branch can't be force-pushed or deleted, and PRs into it require the same CI checks and reviews astrunk.publish_releaseremoves that protection again when it deletes the branch at the end of the release.This mirrors what WPiOS, WPAndroid, WooCommerce, Simplenote, Tumblr, Day One and Pocket Casts have been doing for years.
Two details worth knowing for the review:
trunk's protection has "Do not allow bypassing the above settings" off in this repo's GitHub Settings, andwpmobilebotis an admin on this repo; so the version bumps thatnew_beta_releaseandfinalize_releasepush straight to the release branch keep working. Everyone else goes through PRs, which is already the case ontrunk. If we ever enable admin enforcement ontrunk, the release automation would start failing on those direct pushes, and we'd need to add theset_branch_protection(…, enforce_admins: false)extra call like we do on some other repos in that case to solve it.Performance Metricsjob needed a CI change. It's one oftrunk's five required checks, but its step only ran fortrunkbuilds and PRs based ontrunk. Copied verbatim onto a release branch, any PR targeting that branch (e.g. a fix for a bug caught during the beta period) would sit forever waiting on a check that never reports. So the step now also runs for PRs based onrelease/*. The alternative — requiring a smaller set of checks on release branches — would have meant keeping that exclusion list in sync withtrunk's settings by hand.Hotfix branches, which
new_hotfix_releasealso creates asrelease/*, are deliberately left unprotected: that matches the other repos, where only code freeze protects. Happy to follow up separately if we'd rather cover them too.Testing Instructions
There's no way to fully exercise this before the next code freeze, but the pieces can be checked independently.
The protection call itself, on a throwaway branch (needs a
GITHUB_TOKENwith admin rights on the repo):The CI change is visible on this very PR: it targets
trunk, soPerformance Metricsmust still run and report as before. To confirm the release-branch case, open a throwaway non-draft PR against arelease/*branch and check that the job is created.Then, at the next code freeze, verify that
release/<version>shows up as protected withtrunk's required checks, that the beta version bumps still push to it, and thatpublish_releasedeletes it cleanly at the end.Pre-merge Checklist
ruby -con theFastfile, a YAML parse ofpipeline.yml, and thefastlane/test/*_test.rbsuites all pass.