From de4714eee164a36f2d576ba7062dae713eb265b8 Mon Sep 17 00:00:00 2001 From: Ryan Emerson Date: Thu, 7 Sep 2023 13:57:21 +0100 Subject: [PATCH] Add backport GH action --- .github/workflows/backport.yaml | 31 ++++++++++++++++++++++++++ .github/workflows/backport_reaper.yaml | 19 ++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 .github/workflows/backport.yaml create mode 100644 .github/workflows/backport_reaper.yaml diff --git a/.github/workflows/backport.yaml b/.github/workflows/backport.yaml new file mode 100644 index 00000000..89bfd92a --- /dev/null +++ b/.github/workflows/backport.yaml @@ -0,0 +1,31 @@ +name: Automated Backporting + +on: + pull_request_target: + types: + - closed + branches: + - main + +jobs: + create_backport: + if: github.event.pull_request.merged == true + runs-on: ubuntu-latest + steps: + - if: contains(github.event.pull_request.labels.*.name, '13.x') + name: 13.x Backport + uses: kiegroup/git-backporting@v4.2.0 + with: + target-branch: 13.x + pull-request: ${{ github.event.pull_request.url }} + auth: ${{ secrets.GITHUB_TOKEN }} + no-squash: true + + - if: contains(github.event.pull_request.labels.*.name, '14.x') + name: 14.x Backport + uses: kiegroup/git-backporting@v4.2.0 + with: + target-branch: 14.x + pull-request: ${{ github.event.pull_request.url }} + auth: ${{ secrets.GITHUB_TOKEN }} + no-squash: true diff --git a/.github/workflows/backport_reaper.yaml b/.github/workflows/backport_reaper.yaml new file mode 100644 index 00000000..7b664b0c --- /dev/null +++ b/.github/workflows/backport_reaper.yaml @@ -0,0 +1,19 @@ +name: Backport branch reaper + +on: + pull_request_target: + types: + - closed + branches: + - '*.x' + +jobs: + remove_backport_branch: + if: startsWith(github.event.pull_request.head.ref, 'bp-') + runs-on: ubuntu-latest + steps: + - name: Delete PR head branches + uses: dawidd6/action-delete-branch@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + numbers: ${{github.event.pull_request.number}}