Skip to content

Commit

Permalink
fix: multiple merge conflicts (#2419)
Browse files Browse the repository at this point in the history
Co-authored-by: GitHub Actions <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Jakub Żerko <iot.zerko@gmail.com>
  • Loading branch information
3 people committed Nov 14, 2023
1 parent d0404eb commit ee5105c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/cherry-pick-rc-to-develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ on:
- closed

env:

TARGET_BRANCH: develop
SUBMODULE_NAME: kalium

Expand Down Expand Up @@ -119,7 +118,8 @@ jobs:
OUTPUT=$(git cherry-pick ${{ env.cherryPickCommit }} || true)
# Handle conflicts
CONFLICTED_FILES=$(git diff --name-only --diff-filter=U)
CONFLICTED_FILES=$(git diff --name-only --diff-filter=U | awk 'ORS="\\\\n"' | sed 's/\\\\n$/\\n/')
echo "Captured conflicted files: $CONFLICTED_FILES"
if [[ "$OUTPUT" == *"CONFLICT"* ]]; then
# Commit the remaining conflicts
git commit -am "Commit with unresolved merge conflicts outside of ${{ env.SUBMODULE_NAME }}"
Expand All @@ -139,5 +139,6 @@ jobs:
PR_TITLE: ${{ github.event.pull_request.title }}
PR_BRANCH: ${{ env.newBranchName }}
PR_ASSIGNEE: ${{ github.event.pull_request.user.login }}
PR_BODY: "${{ format('Cherry pick from the original PR: \n- #{0}\n\n---- \n\n ⚠️ Conflicts during cherry-pick:\n{1}\n\n{2}', github.event.pull_request.number, env.conflictedFiles, github.event.pull_request.body) }}"
run: gh pr create --title "$PR_TITLE" --body "$PR_BODY" --base ${{ env.TARGET_BRANCH }} --head "$PR_BRANCH" --label "cherry-pick" --assignee "$PR_ASSIGNEE"
run: |
PR_BODY=$(echo -e "Cherry pick from the original PR: \n- #${{ github.event.pull_request.number }}\n\n---- \n\n ⚠️ Conflicts during cherry-pick:\n${{ env.conflictedFiles }}\n\n${{ github.event.pull_request.body }}")
gh pr create --title "$PR_TITLE" --body "$PR_BODY" --base ${{ env.TARGET_BRANCH }} --head "$PR_BRANCH" --label "cherry-pick" --assignee "$PR_ASSIGNEE"

0 comments on commit ee5105c

Please sign in to comment.