Skip to content

Commit fdf4816

Browse files
Update backport.yml
1 parent 1b98fde commit fdf4816

File tree

1 file changed

+32
-9
lines changed

1 file changed

+32
-9
lines changed

.github/workflows/backport.yml

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,40 @@
1-
name: Backport merged pull request
1+
name: Backport labeled merged pull requests
22
on:
3-
pull_request_target:
3+
pull_request:
44
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+
88
jobs:
99
backport:
10-
name: Backport pull request
10+
name: Create backport PRs
1111
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+
)
1425
steps:
1526
- uses: actions/checkout@v4
16-
- name: Create backport pull requests
27+
- name: Create backport PRs
1728
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

Comments
 (0)