Skip to content

Commit 2bf1979

Browse files
authored
add github workflow for backport (#23)
Signed-off-by: Chenyang Ji <[email protected]>
1 parent dcda4b8 commit 2bf1979

File tree

4 files changed

+59
-0
lines changed

4 files changed

+59
-0
lines changed

Diff for: .github/workflows/add-untriaged.yml

+3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ on:
44
issues:
55
types: [opened, reopened, transferred]
66

7+
env:
8+
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
9+
710
jobs:
811
apply-label:
912
runs-on: ubuntu-latest

Diff for: .github/workflows/backport.yml

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Backport
2+
on:
3+
pull_request_target:
4+
types:
5+
- closed
6+
- labeled
7+
8+
jobs:
9+
backport:
10+
name: Backport
11+
runs-on: ubuntu-latest
12+
# Only react to merged PRs for security reasons.
13+
# See https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request_target.
14+
if: >
15+
github.event.pull_request.merged
16+
&& (
17+
github.event.action == 'closed'
18+
|| (
19+
github.event.action == 'labeled'
20+
&& contains(github.event.label.name, 'backport')
21+
)
22+
)
23+
permissions:
24+
contents: write
25+
pull-requests: write
26+
steps:
27+
- name: GitHub App token
28+
id: github_app_token
29+
uses: tibdex/[email protected]
30+
with:
31+
app_id: ${{ secrets.APP_ID }}
32+
private_key: ${{ secrets.APP_PRIVATE_KEY }}
33+
installation_id: 22958780
34+
35+
- name: Backport
36+
uses: VachaShah/[email protected]
37+
with:
38+
github_token: ${{ steps.github_app_token.outputs.token }}
39+
head_template: backport/backport-<%= number %>-to-<%= base %>
40+
failure_labels: backport-failed

Diff for: .github/workflows/build-and-test.yml

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88
- "*"
99
env:
1010
OPENSEARCH_DASHBOARDS_VERSION: 'main'
11+
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
1112

1213
jobs:
1314
Get-CI-Image-Tag:

Diff for: .github/workflows/delete-backport-branch.yml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Delete merged branch of the backport PRs
2+
on:
3+
pull_request:
4+
types:
5+
- closed
6+
7+
jobs:
8+
delete-branch:
9+
runs-on: ubuntu-latest
10+
if: startsWith(github.event.pull_request.head.ref,'backport/')
11+
steps:
12+
- name: Delete merged branch
13+
uses: SvanBoxel/delete-merged-branch@main
14+
env:
15+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)