This document describes the automated backport workflow for wavelength. It
backports merged main pull requests to release branches (for example,
v0.1.x-branch) without manual cherry-picking.
Instead of manually creating branches, cherry-picking commits, and opening PRs,
a maintainer adds a label to the merged main PR and the workflow does the rest:
it validates the target branch, cherry-picks the commits, and opens a PR against
the release branch.
- Merge a PR to
main(or start from one already merged). - Add a backport label in the format
backport-v<version>-branch, for examplebackport-v0.1.x-branch. - The workflow then:
- validates the target branch exists,
- cherry-picks the commits,
- opens a new PR targeting the release branch.
The label can be added before or after the merge — both trigger the workflow. Adding it before merge fires on the PR-close event; adding it afterward fires on the label event.
Labels must start with backport-v to trigger the workflow:
- ✅
backport-v0.1.x-branch→ backports tov0.1.x-branch - ✅
backport-v0.2.x-branch→ backports tov0.2.x-branch
These labels are ignored:
- ❌
backport candidate— discussion label only - ❌
backport-candidate— does not start withbackport-v - ❌
needs-backport— wrong prefix
This lets you use discussion labels without accidentally triggering a backport.
The branch name is everything after the backport- prefix:
Label: backport-v0.1.x-branch
↓ (drop "backport-")
Branch: v0.1.x-branch
- Checkout — fetch full history and check out the PR's base branch
(usually
main). - Validate target branches — for each
backport-v*label, extract the branch name and confirm it exists onorigin. If a labeled branch is missing, that branch is skipped; the job only fails if every labeled branch is missing. - Create backport PRs — for each valid label, cherry-pick the PR's commits
onto a fresh
backport-<pr-number>-to-<target-branch>branch and open a PR against the release branch. Merge commits are skipped; authorship and commit messages are preserved. The backport PR title is[<target-branch>] Backport #<pr-number>: <original title>and its body links back to the original PR.
When the cherry-pick applies cleanly, the workflow opens a regular (non-draft) PR ready for review. When it conflicts, the workflow commits the conflict markers and opens a draft PR. Resolve it manually:
git fetch origin
git checkout backport-<pr-number>-to-v0.1.x-branch
# resolve conflicts in the affected files
git add <resolved-files>
git commit -m "Resolve backport conflicts"
git push origin backport-<pr-number>-to-v0.1.x-branch
# mark the PR "Ready for review" in the GitHub UITest locally before pushing, explain what conflicts were resolved in the commit message, and get the backport PR reviewed like any other change.
Add multiple backport-v* labels to backport to several release branches at
once. Each backport is processed independently: one may apply cleanly while
another conflicts, and each produces its own branch and PR.
- Workflow file:
.github/workflows/backport.yml - Triggers:
pull_request_targeton[closed, labeled] - Condition: runs only when the PR is actually merged and carries at least
one label containing
backport-v - Action:
korthout/backport-action, pinned to a commit hash, withlabel_pattern: '^backport-(v.+)$',merge_commits: skip, and draft PRs on conflict
See release_branch_management.md for how release branches are created and tagged.