Add backports support

Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
(cherry picked from commit 99cb7c0e08)
This commit is contained in:
Pedro Algarvio 2023-04-26 10:32:16 +01:00 committed by Pedro Algarvio
parent e3ca4bfb19
commit 8f52a3c1f7
2 changed files with 63 additions and 0 deletions

15
.backportrc.json Normal file
View file

@ -0,0 +1,15 @@
{
"repoOwner": "saltstack",
"repoName": "salt",
"targetBranchChoices": ["master", "3006.x", "3005.x"],
"autoMerge": false,
"autoMergeMethod": "rebase",
"branchLabelMapping": {
"^backport:(.+)$": "$1"
},
"prTitle": "[BACKPORT] {commitMessages}",
"publishStatusCommentOnSuccess": true,
"sourcePRLabels": [
"backport:complete"
]
}

48
.github/workflows/backport.yml vendored Normal file
View file

@ -0,0 +1,48 @@
name: Backport PR
run-name: "Backport PR #${{ github.event.number }}"
on:
pull_request_target:
types:
- "labeled"
- "closed"
permissions:
contents: write
pull-requests: write
jobs:
backport:
name: Backport PR
runs-on:
- ubuntu-latest
if: |
github.event.pull_request.merged == true
&& (
contains(github.event.pull_request.labels.*.name, 'backport:master') ||
contains(github.event.pull_request.labels.*.name, 'backport:3006.x') ||
contains(github.event.pull_request.labels.*.name, 'backport:3005.x')
)
&& (
(github.event.action == 'labeled' && (
contains(github.event.pull_request.labels.*.name, 'backport:master') ||
contains(github.event.pull_request.labels.*.name, 'backport:3006.x') ||
contains(github.event.pull_request.labels.*.name, 'backport:3005.x')
))
|| (github.event.action == 'closed')
)
steps:
- name: Backport Action
uses: sqren/backport-github-action@v8.9.7
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
auto_backport_label_prefix: "backport:"
add_original_reviewers: true
- name: Info log
if: ${{ success() }}
run: jq -C '.' ~/.backport/backport.info.log
- name: Debug log
if: ${{ failure() }}
run: jq -C '.' ~/.backport/backport.debug.log