summaryrefslogtreecommitdiffstatshomepage
path: root/.github/workflows/backport.yml
blob: 6275e61f5a3a6b96e8db61a529179d1be518f9bb (plain)
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
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@v6
        with:
          persist-credentials: true

      - uses: actions/create-github-app-token@v3
        id: app-token
        with:
          app-id: ${{ vars.BACKPORT_APP }}
          private-key: ${{ secrets.BACKPORT_KEY }}

      - name: Create backport PR
        id: backport
        uses: korthout/backport-action@3c06f323a58619da1e8522229ebc8d5de2633e46 # v4.3.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}"