lnd icon indicating copy to clipboard operation
lnd copied to clipboard

Backport workflow

Open ziggie1984 opened this issue 1 month ago • 2 comments

Summary

This PR introduces an automated backport workflow that simplifies backporting merged PRs from master to release branches.

How It Works

  1. Merge a PR to master (or have it already merged)
  2. Add a backport label in format: backport-v<version>-branch
    • Example: backport-v0.20.x-branch
  3. Workflow automatically:
    • Validates the target branch exists
    • Cherry-picks commits to a new branch
    • Creates a PR targeting the release branch
    • Adds no-changelog label (release notes already in master PR)

Key Features

  • Label-driven: Just add backport-v0.20.x-branch to trigger
  • Branch validation: Fails fast if target branch doesn't exist
  • Multiple backports: Add multiple labels to backport to several branches simultaneously
  • Conflict handling: Creates draft PR with conflict markers for manual resolution
  • Skip merge commits: Only cherry-picks actual changes, ignores sync merges
  • No manual work: Eliminates manual branch creation, cherry-picking, and PR creation

Example 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

  • Detailed guide: docs/backport-workflow.md
  • Contributing: docs/code_contribution_guidelines.md

ziggie1984 avatar Dec 09 '25 09:12 ziggie1984

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.

ziggie1984 avatar Dec 09 '25 16:12 ziggie1984

/gemini review

ziggie1984 avatar Dec 09 '25 16:12 ziggie1984