-
Notifications
You must be signed in to change notification settings - Fork 368
52 lines (48 loc) · 1.76 KB
/
backport.yaml
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
47
48
49
50
51
52
name: Backport
on:
pull_request_target:
types: [closed, labeled]
branches: [main, release-*]
# WARNING:
# When extending this action, be aware that $GITHUB_TOKEN allows write access to
# the GitHub repository. This means that it should not evaluate user input in a
# way that allows code injection.
jobs:
backport:
name: Backport Pull Request
# Run the action if a PR is merged with backport labels
# OR
# when already merged PR is labeled with backport labels
if: >
github.event.pull_request.merged
&& (
github.event.action == 'closed'
|| (
github.event.action == 'labeled'
&& startsWith(github.event.label.name, 'backport/')
)
)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
# required to find all branches
fetch-depth: 0
token: ${{ secrets.GH_BACKPORT_TOKEN }}
ref: ${{ github.event.pull_request.head.sha }}
- name: Create backport PRs
# should be kept in sync with `version`
uses: zeebe-io/[email protected]
with:
# Config README: https://github.com/zeebe-io/backport-action#backport-action
github_token: ${{ secrets.GH_BACKPORT_TOKEN }}
github_workspace: ${{ github.workspace }}
# should be kept in sync with `uses`
version: v0.0.8
# Regex pattern to match github labels
# The capture group catches the target branch
# i.e. label backport/release-1.23 will create backport PR for branch release-1.23
label_pattern: ^backport\/([^ ]+)$
pull_description: |-
Automated backport to `${target_branch}`, triggered by a label in #${pull_number}.
See ${issue_refs}.