From 82ec3f55d04b5c9c84e847d2d22d87453252bdb6 Mon Sep 17 00:00:00 2001 From: Nianyu Shen Date: Thu, 21 Sep 2023 11:23:10 -0700 Subject: [PATCH] add backport github action (#60) --- .backportrc.json | 14 ++++++++++++++ .github/workflows/backport.yaml | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 .backportrc.json create mode 100644 .github/workflows/backport.yaml diff --git a/.backportrc.json b/.backportrc.json new file mode 100644 index 0000000..fc7c4a1 --- /dev/null +++ b/.backportrc.json @@ -0,0 +1,14 @@ +{ + "repoOwner": "spectrocloud", + "repoName": "CanvOS", + "editor": "code", + + "targetBranchChoices": ["master", "rc-4.0", "release-3.4"], + + "autoMerge": false, + "autoMergeMethod": "squash", + "commitConflicts": true, + "branchLabelMapping": { + "^backport-(.+)$": "$1" + } +} diff --git a/.github/workflows/backport.yaml b/.github/workflows/backport.yaml new file mode 100644 index 0000000..fe5aa07 --- /dev/null +++ b/.github/workflows/backport.yaml @@ -0,0 +1,32 @@ +name: Backport + +on: + pull_request_target: + types: ["labeled", "closed"] + +jobs: + backport: + name: Backport PR + runs-on: ubuntu-latest + if: | + github.event.pull_request.merged == true + && contains(github.event.pull_request.labels.*.name, 'auto-backport') + && ( + (github.event.action == 'labeled' && github.event.label.name == 'auto-backport') + || (github.event.action == 'closed') + ) + steps: + - name: Backport Action + uses: sqren/backport-github-action@v9.2.2 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + auto_backport_label_prefix: backport- + add_original_reviewers: true + + - name: Info log + if: ${{ success() }} + run: cat ~/.backport/backport.info.log + + - name: Debug log + if: ${{ failure() }} + run: cat ~/.backport/backport.debug.log