-
Notifications
You must be signed in to change notification settings - Fork 387
feat: add automated backporting to release branches #796
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| { | ||
| "branchLabelMapping": { | ||
| "^backport-to-(release/.+)$": "$1" | ||
| }, | ||
| "prTitle": "{commitMessages} (backport to {targetBranch})", | ||
| "targetPRLabels": ["backport"], | ||
| "autoMerge": false | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| # Backporting to release branches | ||
|
|
||
| Backports merged `main` changes onto long-term `release/*` branches as PRs. | ||
| Config lives in `.backportrc.json` and is shared by both methods below. | ||
|
|
||
| ## Immediate (one PR) | ||
|
|
||
| Add a label `backport-to-release/<branch>` to the PR (before or after merge), | ||
| e.g. `backport-to-release/1.14.x`. On merge, the Backport workflow opens a | ||
| backport PR to that branch. Add multiple labels to fan out to several branches. | ||
| A clean cherry-pick opens the PR automatically; a conflict instead comments on | ||
| the source PR (finish it with the CLI below). | ||
|
|
||
| > The label must exist before you can apply it. When labeling for a new branch | ||
| > the first time, create the label (the labels box offers "Create new label"). | ||
|
|
||
| ## Batch (many PRs at once) | ||
|
|
||
| One-time local auth: create `~/.backport/config.json` with | ||
| `{ "accessToken": "<a GitHub token with repo scope>" }`. | ||
|
|
||
| Then gather and select interactively (targets passed at runtime, so any | ||
| `release/*` works without editing config): | ||
|
|
||
| ```bash | ||
| # By query, then arrow-key multi-select the PRs: | ||
| npx backport --pr-query "merged:>=2026-05-01 label:backport-pending" \ | ||
| --branch release/1.15.0 --branch release/1.14.x | ||
| # Or by path / single PR: | ||
| npx backport --path en/use-dify --branch release/1.14.x | ||
| npx backport --pr 792 --branch release/1.14.x | ||
| ``` | ||
|
|
||
| ## Finishing a conflicting backport | ||
|
|
||
| ```bash | ||
| npx backport --pr <source-pr-number> --branch release/<branch> | ||
| # resolve the conflict when prompted; the CLI pushes and opens the PR | ||
| ``` |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| name: Backport merged PR | ||
| on: | ||
| pull_request_target: | ||
| types: [labeled, closed] | ||
| permissions: | ||
| contents: read | ||
| pull-requests: read | ||
| jobs: | ||
| backport: | ||
| if: github.event.pull_request.merged == true | ||
| runs-on: depot-ubuntu-24.04 | ||
| steps: | ||
| - uses: sorenlouv/backport-github-action@v12 | ||
| with: | ||
| github_token: ${{ secrets.BACKPORT_TOKEN }} | ||
| auto_backport_label_prefix: backport-to- | ||
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.