-
Notifications
You must be signed in to change notification settings - Fork 42
59 lines (56 loc) · 1.97 KB
/
BACKPORT_PR.yml
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
48
49
50
51
52
53
54
55
56
57
58
59
name: Backport merged pull request
on:
pull_request_target:
types: [ closed ]
issue_comment:
types: [ created ]
permissions:
contents: write # so it can comment
pull-requests: write # so it can create pull requests
jobs:
backport:
name: Backport pull request
runs-on: ubuntu-latest
# Only run when pull request is merged
# or when a comment containing `/backport` is created by someone other than the
# https://github.com/backport-action bot user (user id: 97796249)
if: >
(
github.event_name == 'pull_request_target' &&
github.event.pull_request.merged
) || (
github.event_name == 'issue_comment' &&
github.event.issue.pull_request &&
github.event.comment.user.id != 97796249 &&
startsWith(github.event.comment.body, '/backport')
)
steps:
- name: Import Secrets
id: vault-secrets
uses: hashicorp/vault-action@v3.1.0
with:
url: ${{ secrets.VAULT_ADDR }}
method: approle
roleId: ${{ secrets.VAULT_ROLE_ID }}
secretId: ${{ secrets.VAULT_SECRET_ID}}
secrets: |
secret/data/products/connectors/ci/common GITHUB_APP_ID;
secret/data/products/connectors/ci/common GITHUB_APP_PRIVATE_KEY;
- name: Generate a GitHub token for connectors
id: app-token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ steps.vault-secrets.outputs.GITHUB_APP_ID }}
private-key: ${{ steps.vault-secrets.outputs.GITHUB_APP_PRIVATE_KEY }}
- uses: actions/checkout@v4
with:
# PR created by GitHub Action bot will not trigger CI checks
token: ${{ steps.app-token.outputs.token }}
- name: Create backport pull requests
uses: korthout/backport-action@v3
with:
github_token: ${{ steps.app-token.outputs.token }}
experimental: >
{
"detect_merge_method": true
}