mirror of
https://github.com/coder/coder.git
synced 2026-09-22 05:05:20 +08:00
ci: add automatic backport workflow (#24025)
Adds a GitHub Actions workflow that automatically cherry-picks merged PRs to the last 3 release branches when the `backport` label is applied. ## How it works 1. Add the `backport` label to any PR targeting `main` (before or after merge). 2. On merge (or on label if already merged), the workflow discovers the latest 3 `release/*` branches by semver. 3. For each branch, it cherry-picks the merge commit (`-x -m1`) and opens a PR. Created backport PRs follow existing repo conventions: - **Branch:** `backport/<pr>-to-<version>` - **Title:** `<original PR title> (#<pr>)` — e.g. `fix(site): correct button alignment (#12345)` - **Body:** links back to the original PR and merge commit If cherry-pick has conflicts, the PR is still opened with instructions for manual resolution — no conflict markers are committed. Also: - Removes `scripts/backport-pr.sh` (replaced by this workflow) - Removes `.github/cherry-pick-bot.yml` (old bot config) - Adds a section to the contributing docs explaining how to use the backport label > [!NOTE] > Generated with [Coder Agents](https://coder.com/agents)
This commit is contained in:
@@ -291,18 +291,22 @@ specification, however, it's still possible to merge PRs on GitHub with a badly
|
||||
formatted title. Take care when merging single-commit PRs as GitHub may prefer
|
||||
to use the original commit title instead of the PR title.
|
||||
|
||||
### Cherry-picking to the latest release branch
|
||||
### Backporting fixes to release branches
|
||||
|
||||
When a merged PR on `main` should also ship in the current release,
|
||||
add the **`cherry-pick`** label to the PR (before or after merge).
|
||||
When a merged PR on `main` should also ship in older releases, add the
|
||||
`backport` label to the PR. The
|
||||
[backport workflow](https://github.com/coder/coder/blob/main/.github/workflows/backport.yaml)
|
||||
will automatically detect the latest three `release/*` branches,
|
||||
cherry-pick the merge commit onto each one, and open PRs for
|
||||
review.
|
||||
|
||||
The automation detects the latest `release/*` branch, cherry-picks the
|
||||
merge commit, and opens a PR for review. The PR reuses the original
|
||||
title (e.g. `fix(site): correct button alignment (#12345)`) so the
|
||||
change is meaningful in release notes.
|
||||
The label can be added before or after the PR is merged. Each backport
|
||||
PR reuses the original title (e.g.
|
||||
`fix(site): correct button alignment (#12345)`) so the change is
|
||||
meaningful in release notes.
|
||||
|
||||
If the cherry-pick encounters conflicts, the PR is still created with
|
||||
instructions for manual resolution.
|
||||
If the cherry-pick encounters conflicts, the backport PR is still created
|
||||
with instructions for manual resolution — no conflict markers are committed.
|
||||
|
||||
### Breaking changes
|
||||
|
||||
|
||||
Reference in New Issue
Block a user