Skip to content

Commit 86189a5

Browse files
committed
Add backport GitHub Action workflow
This workflow automatically backports pull requests labeled with `backport:<release series branch>`. For example, `backport:release/v1.0.x` to backport the pull request to a `release/v1.0.x` branch. Signed-off-by: Hidde Beydals <[email protected]>
1 parent 6579af0 commit 86189a5

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

.github/workflows/backport.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: backport
2+
3+
on:
4+
pull_request_target:
5+
types: [closed, labeled]
6+
7+
permissions:
8+
contents: read
9+
10+
jobs:
11+
pull-request:
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: write
15+
pull-requests: write
16+
if: github.event.pull_request.state == 'closed' && github.event.pull_request.merged && (github.event_name != 'labeled' || startsWith('backport:', github.event.label.name))
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
20+
with:
21+
ref: ${{ github.event.pull_request.head.sha }}
22+
- name: Create backport PRs
23+
uses: korthout/backport-action@bf5fdd624b35f95d5b85991a728bd5744e8c6cf2 # v1.3.1
24+
# xref: https://github.com/korthout/backport-action#inputs
25+
with:
26+
# Match labels with a pattern `backport:<target-branch>`
27+
label_pattern: '^backport:([^ ]+)$'
28+
# A bit shorter pull-request title than the default
29+
pull_title: '[${target_branch}] ${pull_title}'
30+
# Simpler PR description than default
31+
pull_description: |-
32+
Automated backport to `${target_branch}`, triggered by a label in #${pull_number}.

0 commit comments

Comments
 (0)