Repository navigation
46 lines (42 loc) · 1.56 KB
/
Copy pathbackport.yml
File metadata and controls
46 lines (42 loc) · 1.56 KB
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
name: Backport
on:
pull_request_target:
types: [closed, labeled]
permissions:
contents: write
pull-requests: write
jobs:
backport:
name: Backport PR
runs-on: ubuntu-latest
# Only run on merged PRs that carry a backport label. The `labeled` event
# lets you trigger a backport after the PR is already merged by adding the
# label late.
if: >
github.event.pull_request.merged == true &&
(
github.event.action == 'closed' ||
startsWith(github.event.label.name, 'backport ')
)
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Create backport PRs
uses: korthout/backport-action@d07416681cab29bf2661702f925f020aaa962997 # v3.4.1
with:
# Act only on labels shaped like "backport <target-branch>",
# e.g. "backport main".
label_pattern: '^backport ([^ ]+)$'
# Reuse the source title verbatim. A prefix here would push the
# conventional-commit type out of first position and fail the PR
# Title Check; the "backport" label marks these PRs instead.
pull_title: '${pull_title}'
pull_description: |
Automated backport of #${pull_number} to `${target_branch}`.
add_labels: backport
# Carry the original PR's labels onto the backport PR, except the
# "backport <branch>" label itself — copying it would re-trigger this
# workflow when the generated PR is merged.
copy_labels_pattern: '^(?!backport ).*'