Skip to content

Commit 98ed47d

Browse files
pmacikweb-flow
authored andcommitted
Add GH workflows for cherry-picking PRs to release branches (redhat-developer#1217)
1 parent b7a22a2 commit 98ed47d

File tree

2 files changed

+112
-0
lines changed

2 files changed

+112
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: "Clean cherry pick PR branch"
2+
3+
on:
4+
pull_request_target:
5+
branches:
6+
- 'release-v**.x'
7+
types: [closed]
8+
9+
jobs:
10+
delete-cherry-pick-branch:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: delete-cherry-pick-branch
14+
uses: actions/github-script@v6
15+
env:
16+
REPO: ${{ secrets.SBO_CHERRY_PICK_REPO }}
17+
with:
18+
github-token: ${{ secrets.SBO_CHERRY_PICK_BOT_TOKEN }}
19+
script: |
20+
const [owner, repo] = process.env.REPO.split('/');
21+
const ref = `heads/${context.payload.pull_request.head.ref}`;
22+
const deleteParams = { owner, repo, ref };
23+
console.log(`Deleting branch: "${ref}"`);
24+
try {
25+
github.rest.git.deleteRef(deleteParams);
26+
} catch(e) {
27+
console.log("Cannot delete branch; error:", e);
28+
}
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
name: "Cherry pick PR to release branches"
2+
3+
on:
4+
pull_request_target:
5+
branches:
6+
- master
7+
types: [closed]
8+
9+
jobs:
10+
cherry_pick_release_v1_1_x:
11+
runs-on: ubuntu-latest
12+
name: Cherry pick into release-v1.1.x branch
13+
if: contains(github.event.pull_request.labels.*.name, 'release/v1.1.x') && github.event.pull_request.merged
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v2
17+
with:
18+
fetch-depth: 0
19+
- name: Setup SSH for cherry-pick repo
20+
uses: webfactory/[email protected]
21+
with:
22+
ssh-private-key: ${{ secrets.SBO_CHERRY_PICK_REPO_SSH_PRIVATE_KEY }}
23+
- name: Cherry pick into release-v1.1.x
24+
uses: pmacik/github-cherry-pick-action@main
25+
with:
26+
cherry-pick-repo: ${{ secrets.SBO_CHERRY_PICK_REPO }}
27+
token: ${{ secrets.SBO_CHERRY_PICK_BOT_TOKEN }}
28+
branch: release-v1.1.x
29+
exclude-labels: |
30+
release/v1.2.x
31+
release/v1.3.x
32+
labels: |
33+
cherry-pick
34+
title-prefix: "cherry-pick(release-v1.1.x): "
35+
cherry_pick_release_v1_2_x:
36+
runs-on: ubuntu-latest
37+
name: Cherry pick into release-v1.2.x branch
38+
if: contains(github.event.pull_request.labels.*.name, 'release/v1.2.x') && github.event.pull_request.merged
39+
steps:
40+
- name: Checkout
41+
uses: actions/checkout@v2
42+
with:
43+
fetch-depth: 0
44+
- name: Setup SSH for cherry-pick repo
45+
uses: webfactory/[email protected]
46+
with:
47+
ssh-private-key: ${{ secrets.SBO_CHERRY_PICK_REPO_SSH_PRIVATE_KEY }}
48+
- name: Cherry pick into release-v1.2.x
49+
uses: pmacik/github-cherry-pick-action@main
50+
with:
51+
cherry-pick-repo: ${{ secrets.SBO_CHERRY_PICK_REPO }}
52+
token: ${{ secrets.SBO_CHERRY_PICK_BOT_TOKEN }}
53+
branch: release-v1.2.x
54+
exclude-labels: |
55+
release/v1.1.x
56+
release/v1.3.x
57+
labels: |
58+
cherry-pick
59+
title-prefix: "cherry-pick(release-v1.2.x): "
60+
cherry_pick_release_v1_3_x:
61+
runs-on: ubuntu-latest
62+
name: Cherry pick into release-v1.3.x branch
63+
if: contains(github.event.pull_request.labels.*.name, 'release/v1.3.x') && github.event.pull_request.merged
64+
steps:
65+
- name: Checkout
66+
uses: actions/checkout@v2
67+
with:
68+
fetch-depth: 0
69+
- name: Setup SSH for cherry-pick repo
70+
uses: webfactory/[email protected]
71+
with:
72+
ssh-private-key: ${{ secrets.SBO_CHERRY_PICK_REPO_SSH_PRIVATE_KEY }}
73+
- name: Cherry pick into release-v1.2.x
74+
uses: pmacik/github-cherry-pick-action@main
75+
with:
76+
cherry-pick-repo: ${{ secrets.SBO_CHERRY_PICK_REPO }}
77+
token: ${{ secrets.SBO_CHERRY_PICK_BOT_TOKEN }}
78+
branch: release-v1.3.x
79+
exclude-labels: |
80+
release/v1.1.x
81+
release/v1.2.x
82+
labels: |
83+
cherry-pick
84+
title-prefix: "cherry-pick(release-v1.3.x): "

0 commit comments

Comments
 (0)