Skip to content

CI: Auto cherry-pick to Gutenberg release branches#78879

Open
cbravobernal wants to merge 1 commit into
trunkfrom
add/auto-cherry-pick-gutenberg-release
Open

CI: Auto cherry-pick to Gutenberg release branches#78879
cbravobernal wants to merge 1 commit into
trunkfrom
add/auto-cherry-pick-gutenberg-release

Conversation

@cbravobernal

Copy link
Copy Markdown
Contributor

What?

Adds .github/workflows/cherry-pick-gutenberg-release.yml — an Auto Cherry-Pick workflow for Gutenberg's own release branches, mirroring the existing WP Auto Cherry-Pick workflow (cherry-pick-wp-release.yml).

On merge of a PR to trunk labeled Backport to Gutenberg RC, it:

  1. Resolves the target release branch as the highest release/X.Y (semver sort).
  2. Cherry-picks the merge commit onto that branch and pushes.
  3. Removes the Backport to Gutenberg RC label.
  4. Comments the target branch + cherry-pick SHA on the PR.
  5. On conflict, posts manual-resolution instructions (same as the WP workflow).

Why?

Today these picks are done by hand — e.g. #78848 opened a manual cherry-pick PR onto release/23.3. This automates the label-driven picks, the same way WP backports are already automated.

Design notes

  • Versionless label. Gutenberg's two-week cadence makes a per-release label (like WP's Backport to WP X.Y Beta/RC) impractical, so the label carries no version. The target branch is resolved by picking the highest release/X.Y instead. The chosen target is commented on the PR so a wrong target (e.g. a label applied after stable shipped but before the next branch is cut) is easy to spot.
  • Reuses the existing system: same pull_request_target trigger, same pinned action SHAs, same GUTENBERG_TOKEN secret (which bypasses release/* push protection — the restriction Backport to 23.3: 10 cherry-picks for stable #78848 worked around).

Not covered (still manual)

  • CI-infra picks that aren't label-driven (e.g. browserslist / test-data freshness).
  • Milestone assignment for changelog regen.

Testing

Workflow logic mirrors the proven cherry-pick-wp-release.yml 1:1, differing only in label match, target-branch resolution, and label cleanup. Needs a maintainer to validate on a real merge once landed.

🤖 Generated with Claude Code

Mirror the existing WP Auto Cherry-Pick workflow for Gutenberg's own
release branches. On merge of a PR labeled `Backport to Gutenberg RC`,
cherry-pick the merge commit onto the highest `release/X.Y` branch,
push, remove the label, and comment the target branch + cherry-pick SHA.

The Gutenberg backport label is versionless (the two-week cadence makes
a per-release label impractical), so the target branch is resolved by
semver-sorting `release/*` and picking the highest. Conflicts post a
manual-resolution comment, matching the WP workflow.

This removes the need for manual cherry-pick PRs like #78848 for the
label-driven picks.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@cbravobernal cbravobernal requested a review from desrosj as a code owner June 2, 2026 11:39
@github-actions

github-actions Bot commented Jun 2, 2026

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: cbravobernal <cbravobernal@git.wordpress.org>
Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
Co-authored-by: arthur791004 <arthur791004@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@cbravobernal cbravobernal self-assigned this Jun 2, 2026
@cbravobernal cbravobernal added [Type] Build Tooling Issues or PRs related to build tooling [Type] Enhancement A suggestion for improvement. labels Jun 2, 2026
@cbravobernal cbravobernal requested a review from Mamaduka June 2, 2026 12:16
@cbravobernal cbravobernal added [Package] Project management automation /packages/project-management-automation [Type] Project and removed [Type] Enhancement A suggestion for improvement. [Type] Build Tooling Issues or PRs related to build tooling labels Jun 2, 2026
# Using pull_request_target instead of pull_request so that the workflow
# has access to repository secrets for fork PRs.
# https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#pull_request_target
pull_request_target:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After recent events in the security world, are we still using pull_request_target?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are still using it. And the script is meant to run only in already reviewed and merged PRs. But happy to have a second opinion. @pkevan may help us?

@arthur791004

Copy link
Copy Markdown
Contributor

Would it be better to also support "Backport to Gutenberg Minor Release" as well?

@cbravobernal

Copy link
Copy Markdown
Contributor Author

Would it be better to also support "Backport to Gutenberg Minor Release" as well?

Gutenberg Minors are usually less common than cherry-picking to RCs before a point release, maybe we could do it in a different PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] Project management automation /packages/project-management-automation [Type] Project

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants