2023-11-12 13:40:24 -07:00
|
|
|
name: backport
|
2021-10-26 08:45:15 -07:00
|
|
|
on:
|
|
|
|
pull_request_target:
|
|
|
|
types: [closed, labeled]
|
|
|
|
jobs:
|
|
|
|
backport:
|
2021-10-30 13:27:54 -07:00
|
|
|
permissions:
|
|
|
|
contents: write
|
|
|
|
pull-requests: write
|
2021-10-26 08:45:15 -07:00
|
|
|
name: Backport Pull Request
|
2023-04-08 04:14:13 -07:00
|
|
|
if: github.event.pull_request.merged
|
2021-10-26 08:45:15 -07:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2023-09-04 05:51:40 -07:00
|
|
|
- uses: actions/checkout@v4
|
2024-07-16 03:51:53 -07:00
|
|
|
|
|
|
|
- uses: actions/create-github-app-token@v1
|
|
|
|
id: app-token
|
|
|
|
with:
|
|
|
|
app-id: ${{ vars.BACKPORT_APP }}
|
|
|
|
private-key: ${{ secrets.BACKPORT_KEY }}
|
|
|
|
|
2024-05-01 06:39:46 -07:00
|
|
|
- name: Create backport PR
|
|
|
|
id: backport
|
2024-05-27 09:42:45 -07:00
|
|
|
uses: korthout/backport-action@v3
|
2024-01-01 06:35:35 -07:00
|
|
|
with:
|
2024-05-01 06:39:46 -07:00
|
|
|
pull_title: "${pull_title}"
|
|
|
|
label_pattern: "^ci:backport ([^ ]+)$"
|
2024-07-16 03:51:53 -07:00
|
|
|
github_token: ${{ steps.app-token.outputs.token }}
|
2024-09-10 15:55:38 -07:00
|
|
|
|
2024-09-13 06:27:57 -07:00
|
|
|
- name: Create failed backport label
|
|
|
|
if: ${{ steps.backport.outputs.was_successful == 'false' }}
|
|
|
|
uses: actions/github-script@v7
|
|
|
|
with:
|
|
|
|
script: |
|
|
|
|
github.rest.issues.addLabels({
|
|
|
|
issue_number: context.issue.number,
|
|
|
|
owner: context.repo.owner,
|
|
|
|
repo: context.repo.repo,
|
|
|
|
labels: ['needs:backport']
|
|
|
|
})
|
|
|
|
|
2024-09-10 15:55:38 -07:00
|
|
|
- name: Enable automerge
|
2024-09-13 07:50:08 -07:00
|
|
|
if: ${{ steps.backport.outputs.was_successful == 'true' }}
|
2024-09-10 15:55:38 -07:00
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
run: gh pr merge --rebase --auto ${{ steps.backport.outputs.created_pull_numbers }}
|