|
1 | | -name: Backport merged pull request |
| 1 | +name: Backport labeled merged pull requests |
2 | 2 | on: |
3 | | - pull_request_target: |
| 3 | + pull_request: |
4 | 4 | types: [closed] |
5 | | -permissions: |
6 | | - contents: write # so it can comment |
7 | | - pull-requests: write # so it can create pull requests |
| 5 | + issue_comment: |
| 6 | + types: [created] |
| 7 | + |
8 | 8 | jobs: |
9 | 9 | backport: |
10 | | - name: Backport pull request |
| 10 | + name: Create backport PRs |
11 | 11 | runs-on: ubuntu-latest |
12 | | - # Don't run on closed unmerged pull requests |
13 | | - if: github.event.pull_request.merged |
| 12 | + # Only run when pull request is merged |
| 13 | + # or when a comment starting with `/backport` is created by someone other than the |
| 14 | + # https://github.com/backport-action bot user (user id: 97796249). Note that if you use your |
| 15 | + # own PAT as `github_token`, that you should replace this id with yours. |
| 16 | + if: > |
| 17 | + ( |
| 18 | + github.event_name == 'pull_request' && |
| 19 | + github.event.pull_request.merged |
| 20 | + ) || ( |
| 21 | + github.event_name == 'issue_comment' && |
| 22 | + github.event.issue.pull_request && |
| 23 | + startsWith(github.event.comment.body, '/backport') |
| 24 | + ) |
14 | 25 | steps: |
15 | 26 | - uses: actions/checkout@v4 |
16 | | - - name: Create backport pull requests |
| 27 | + - name: Create backport PRs |
17 | 28 | uses: korthout/backport-action@v3 |
| 29 | + with: |
| 30 | + pull_description: |- |
| 31 | + # Description |
| 32 | + Backport of #${pull_number} to `${target_branch}`. |
| 33 | +
|
| 34 | + relates to ${issue_refs} |
| 35 | +
|
| 36 | + add_author_as_assignee: true |
| 37 | + experimental: > |
| 38 | + { |
| 39 | + "conflict_resolution": "draft_commit_conflicts" |
| 40 | + } |
0 commit comments