From 72275cb4dd763d662bbadd4afea884b48dc3bbae Mon Sep 17 00:00:00 2001 From: elius mgani <78465509+av-dev2@users.noreply.github.com> Date: Tue, 3 Feb 2026 13:02:06 +0300 Subject: [PATCH 1/2] feat: add GitHub Action for automatic backporting of PRs - Add backport.yml workflow that triggers on merged PRs with backport labels - Supports label pattern 'backport-to-' for targeting specific branches - Automatically creates backport PRs with proper titles and descriptions - Reports failures with manual cherry-pick instructions - Copies reviewers, assignees, and non-backport labels to new PRs --- backport.yml | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 backport.yml diff --git a/backport.yml b/backport.yml new file mode 100644 index 000000000..ba26202c0 --- /dev/null +++ b/backport.yml @@ -0,0 +1,56 @@ +name: Backport PR + +on: + pull_request_target: + types: [closed, labeled] + +permissions: + contents: write + pull-requests: write + +jobs: + backport: + name: Backport PR + if: > + github.event.pull_request.merged == true + && contains(join(github.event.pull_request.labels.*.name, ','), 'backport') + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Create backport PRs + uses: korthout/backport-action@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + label_pattern: "^backport-to-(.+)$" + pull_title: "[Backport ${target_branch}] ${pull_title}" + pull_description: | + Backport of #${pull_number} to `${target_branch}`. + + --- + + ${pull_description} + merge_commits: "skip" + copy_requested_reviewers: true + copy_assignees: true + copy_labels_pattern: "^(?!backport)" + + - name: Report backport status + if: failure() + uses: actions/github-script@v7 + with: + script: | + const { owner, repo } = context.repo; + const pull_number = context.payload.pull_request.number; + + await github.rest.issues.createComment({ + owner, + repo, + issue_number: pull_number, + body: `⚠️ **Backport failed!**\n\nThe automatic backport could not be completed. This might be due to merge conflicts.\n\nPlease manually cherry-pick the commits to the target branch:\n\n\`\`\`bash\ngit checkout \ngit cherry-pick -x ${context.payload.pull_request.merge_commit_sha}\n\`\`\`\n\nThen create a new PR targeting the branch.` + }); + From 8fd6b697e42885aaec2bf2a71b894f096f79cd6a Mon Sep 17 00:00:00 2001 From: elius mgani <78465509+av-dev2@users.noreply.github.com> Date: Tue, 3 Feb 2026 13:05:38 +0300 Subject: [PATCH 2/2] Rename backport.yml to .github/workflows/backport.yml --- backport.yml => .github/workflows/backport.yml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename backport.yml => .github/workflows/backport.yml (100%) diff --git a/backport.yml b/.github/workflows/backport.yml similarity index 100% rename from backport.yml rename to .github/workflows/backport.yml