Skip to content

Commit 385da08

Browse files
committed
Add possibility to backport PRs
1 parent 3556b1d commit 385da08

1 file changed

Lines changed: 37 additions & 0 deletions

File tree

.github/workflows/backport.yml

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

0 commit comments

Comments
 (0)