blob: d6c679d208538199a52355f92b9b5b570e611113 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
name: backport
on:
pull_request_target:
types: [closed, labeled]
permissions: {}
jobs:
backport:
permissions:
contents: write
pull-requests: write
name: Backport Pull Request
if: github.event.pull_request.merged
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7.0.1
with:
persist-credentials: true
# Check out the merged-into base branch by name. Without an explicit
# ref, checkout resolves to the base tip SHA, which for a _merged_ PR
# equals pull_request.merge_commit_sha and trips the
# actions/checkout@v7.0.1 `allow-unsafe-pr-checkout` guard (false
# positive: this is trusted base code, not fork PR code).
ref: ${{ github.event.pull_request.base.ref }}
- uses: actions/create-github-app-token@v3.2.0
id: app-token
with:
app-id: ${{ vars.BACKPORT_APP }}
private-key: ${{ secrets.BACKPORT_KEY }}
- name: Create backport PR
id: backport
uses: korthout/backport-action@8560fb503c275d433c56f05a2f64850093baa9f7 # v4.7.0
with:
pull_title: "backport: ${pull_title}"
label_pattern: "^ci:backport ([^ ]+)$"
github_token: ${{ steps.app-token.outputs.token }}
- name: Enable automerge
if: ${{ steps.backport.outputs.was_successful == 'true' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CREATED_PULL_NUMBERS: ${{ steps.backport.outputs.created_pull_numbers }}
run: |
gh pr merge --rebase --auto "${CREATED_PULL_NUMBERS}"
|