-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Backport workflow #10435
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
base: master
Are you sure you want to change the base?
Backport workflow #10435
Conversation
9158cb3 to
b152acd
Compare
|
Verified the whole behaviour on my local repo, so take a look at if you wanna see how the created backports work: https://github.com/ziggie1984/lnd/pulls Created a PR which had 2 backport labels set, and also a PR which had a conflict. |
|
/gemini review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces comprehensive documentation for a new automated backport workflow. The new backport-workflow.md file is well-structured and provides clear instructions on how to use the workflow, handle conflicts, and troubleshoot common issues. The contribution guidelines are also updated to reference this new documentation. My review includes a few suggestions to improve clarity and fix a broken link in the new documentation.
b152acd to
2becf8d
Compare
2becf8d to
5a3ece0
Compare
This commit introduces an automated GitHub Actions workflow to streamline the backporting process for merged PRs from master to release branches. Key features: - Triggers on merged PRs with labels matching 'backport-v*' pattern (e.g., backport-v0.20.x-branch) - Validates that target branches exist before attempting backport - Creates separate backport PRs for each target branch - Automatically adds 'no-changelog' label to backport PRs - Handles merge conflicts by creating draft PRs with conflict markers - Supports multiple simultaneous backports via multiple labels Workflow steps: 1. Checkout repository with full git history 2. Validate all target branches exist in the remote repository 3. For each valid backport label: - Create a new branch (backport-<pr-num>-to-<target-branch>) - Cherry-pick commits from the master PR - Create a new PR targeting the release branch - Link back to the original PR 4. If conflicts occur, create a draft PR for manual resolution Label format: - Valid: backport-v0.20.x-branch, backport-v0.19.x-branch - Invalid: backport candidate, backport-candidate, backport-needed This automation reduces manual work and ensures consistency in the backporting process while maintaining full visibility and control for maintainers.
This commit adds detailed documentation for the automated backport workflow and updates the contribution guidelines to reference it. New documentation (docs/backport-workflow.md): - Complete overview of the automated backport process - Step-by-step usage instructions with examples - Detailed explanation of workflow triggers and label format - Technical details about workflow implementation - Conflict resolution procedures and best practices - Multiple backport scenarios and examples - Comprehensive troubleshooting guide Updated contribution guidelines (docs/code_contribution_guidelines.md): - Replaced detailed backport instructions with brief overview - Added reference to the new detailed documentation - Keeps contribution guidelines focused and concise The detailed documentation provides: - How to use backport labels correctly - What happens when labels are added before/after merge - How the workflow validates branches and handles errors - Step-by-step conflict resolution instructions - Solutions for common problems and edge cases - Examples of valid vs invalid label formats This documentation ensures contributors and maintainers have clear guidance on using the automated backport workflow effectively.
5a3ece0 to
bd4fc35
Compare
Roasbeef
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the idea of using an existing solution for this, rather than rolling our own. I'm gonna check out the source of backport-action to learn a bit more about it.
| labels: no-changelog | ||
|
|
||
| # Merge strategy - skip merge commits, use cherry-pick only. | ||
| merge_commits: skip |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the distinction here? As won't we merge the backport PR into the release branch in the end?
| merge_commits: skip | ||
|
|
||
| # If conflicts occur, create a draft PR with conflict markers. | ||
| experimental: '{"conflict_resolution": "draft_commit_conflicts"}' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
| fi | ||
|
|
||
| - name: Create backport PRs | ||
| uses: korthout/backport-action@v3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pin to a hash here?
saubyk
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Concept Ack.
Thanks for the pr and nice work, just a few nits on the documentation.
| - Validates the target branch exists | ||
| - Cherry-picks the commits | ||
| - Creates a new PR targeting the release branch | ||
| - Adds the `no-changelog` label (since release notes are in the master PR) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Assuming there is no CI impact with no-changelog label
| 6. → Backport PR #1235 created immediately | ||
| ``` | ||
|
|
||
| ### Scenario 2: Label After Merge (Recommended) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the reason for this to be a recommended approach?
|
|
||
| - ✅ `backport-v0.20.x-branch` → backports to `v0.20.x-branch` | ||
| - ✅ `backport-v0.19.x-branch` → backports to `v0.19.x-branch` | ||
| - ✅ `backport-v0.18.5-beta-branch` → backports to `v0.18.5-beta-branch` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a scenario, we will cater for? As in, maintain a specific branch for a minor release?
I thought that the idea is to maintain one branch for each major release version and cut minors from that after applying relevant changes.
If that is indeed the case, this last example can be confusing.
|
|
||
| 4. **PR Description** | ||
| ```markdown | ||
| Backport of #1234 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
|
|
||
| ## Multiple Backports | ||
|
|
||
| You can backport to multiple release branches simultaneously by adding multiple labels. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👌
Summary
This PR introduces an automated backport workflow that simplifies backporting merged PRs from
masterto releasebranches.
How It Works
backport-v<version>-branchbackport-v0.20.x-branchno-changeloglabel (release notes already in master PR)Key Features
backport-v0.20.x-branchto triggerExample Usage
PR #1234 merged with label: backport-v0.20.x-branch
→ Workflow creates PR #1235
Title: [v0.20.x-branch] Backport #1234: Original Title
Base: v0.20.x-branch
Labels: no-changelog
Status: Ready for review (or Draft if conflicts)
Documentation