Skip to content

Commit 901b1e2

Browse files
authored
Merge pull request #488 from adigidh/484-workflow
Setup Github Action workflow for auto cherry picking commits
2 parents 7a3b95a + c056901 commit 901b1e2

File tree

1 file changed

+24
-17
lines changed

1 file changed

+24
-17
lines changed

.github/workflows/cherry-pick.yml

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,36 @@
1-
name: Cherry pick PR into release-1.0 branch
1+
name: Cherry-Pick into release-1.0 branch
22

33
on:
4-
pull_request_target:
4+
pull_request:
5+
types: [closed]
56
branches:
67
- main
78

89
jobs:
9-
cherry_pick_release_1_0:
10+
cherry_pick:
11+
if: github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'cherry-pick-release-1.0')
1012
runs-on: ubuntu-latest
11-
name: Cherry pick into release-1.0 branch
12-
if: ${{ contains(github.event.pull_request.labels.*.name, 'cherry-pick-release-1.0') && github.event.pull_request.merged == true }}
1313
steps:
14-
- name: Checkout
14+
- name: Checkout repository
1515
uses: actions/checkout@v4
1616
with:
1717
fetch-depth: 0
18-
- name: Cherry pick into release-1.0 branch
19-
uses: carloscastrojumo/[email protected]
18+
19+
- name: Set up Git
20+
run: |
21+
git config user.name "GitHub Actions Bot"
22+
git config user.email "[email protected]"
23+
24+
- name: Cherry-pick commit
25+
run: |
26+
git checkout release-1.0
27+
git cherry-pick ${{ github.event.pull_request.merge_commit_sha }}
28+
29+
- name: Create Pull Request
30+
uses: peter-evans/create-pull-request@v5
2031
with:
21-
branch: release-1.0
22-
labels: |
23-
cherry-pick
24-
reviewers: |
25-
instructlab/ui-maintainers
26-
title: '[cherry-pick] {old_title}'
27-
body: 'Cherry picking #{old_pull_request_id} onto this branch'
28-
env:
29-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32+
token: ${{ secrets.GITHUB_TOKEN }}
33+
branch: cherry-pick-${{ github.event.pull_request.number }}
34+
base: release-1.0
35+
title: 'Cherry-pick: Add commit to release-1.0 ${{ github.event.pull_request.title }}'
36+
body: 'Automatically cherry-picked commit from main branch'

0 commit comments

Comments
 (0)