-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: automatically cherry-pick changes from release/candidate (#1894)
Co-authored-by: <Jakub Żerko [email protected]> (cherry picked from commit 61695e3)
- Loading branch information
1 parent
33aa16c
commit 7707c49
Showing
1 changed file
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
name: "Cherry-pick from rc to develop" | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- release/candidate | ||
types: | ||
- closed | ||
|
||
jobs: | ||
cherry-pick: | ||
runs-on: ubuntu-latest | ||
if: github.event.pull_request.merged == true | ||
|
||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Append -cherry-pick to branch name | ||
id: extract | ||
run: | | ||
PR_BRANCH="${{ github.event.pull_request.head.ref }}" | ||
NEW_BRANCH_NAME="${PR_BRANCH}-cherry-pick" | ||
echo "New branch name: $NEW_BRANCH_NAME" | ||
echo "::set-output name=newBranchName::$NEW_BRANCH_NAME" | ||
- uses: fregante/setup-git-user@v2 | ||
|
||
- name: Cherry-pick commits | ||
run: | | ||
git fetch origin develop:develop | ||
git checkout -b ${{ steps.extract.outputs.newBranchName }} develop | ||
# Cherry-picking the last commit on the base branch | ||
git cherry-pick -x ${{ github.event.pull_request.merge_commit_sha }} --strategy-option theirs || true | ||
git add . | ||
git cherry-pick --continue || true | ||
git push origin ${{ steps.extract.outputs.newBranchName }} | ||
- name: Create PR | ||
env: | ||
PR_TITLE: ${{ github.event.pull_request.title }} | ||
PR_BRANCH: ${{ steps.extract.outputs.newBranchName }} | ||
PR_ASSIGNEE: ${{ github.event.pull_request.user.login }} | ||
PR_BODY: "${{ format('Cherry pick from the original PR: \n- #{0}\n\n ---- \n{1}', github.event.pull_request.number, github.event.pull_request.body) }}" | ||
run: gh pr create --title "$PR_TITLE" --body "$PR_BODY" --base develop --head $PR_BRANCH --label "cherry-pick" --assignee "$PR_ASSIGNEE" |