Skip to content

Commit

Permalink
chore: print conflicts on cherry-pick
Browse files Browse the repository at this point in the history
  • Loading branch information
Garzas committed Aug 1, 2023
1 parent 17ec885 commit 5848b49
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/cherry-pick-rc-to-develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,22 @@ jobs:
- uses: fregante/setup-git-user@v2

- name: Cherry-pick commits
id: cherry
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 ${{ github.event.pull_request.merge_commit_sha }} --strategy-option theirs || true
OUTPUT=$(git cherry-pick ${{ github.event.pull_request.merge_commit_sha }} --strategy-option theirs || true)
CONFLICTS=$(echo "$OUTPUT" | grep 'CONFLICT')
echo "::set-output name=conflicts::$CONFLICTS"
git add .
git cherry-pick --continue || true
git cherry-pick --continue || echo "No cherry-pick in progress"
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) }}"
PR_BODY: "${{ format('Cherry pick from the original PR: \n- #{0}\n\n ---- \n\n ⚠️ Conflicts during cherry-pick:\n {2} \n\n{1}', github.event.pull_request.number, github.event.pull_request.body, steps.cherry.outputs.conflicts) }}"
run: gh pr create --title "$PR_TITLE" --body "$PR_BODY" --base develop --head $PR_BRANCH --label "cherry-pick" --assignee "$PR_ASSIGNEE"

0 comments on commit 5848b49

Please sign in to comment.