From 236301686cd372c08abd68736b59b34c52218fea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20=C5=BBerko?= Date: Thu, 9 Nov 2023 11:37:45 +0800 Subject: [PATCH] fix: multiple merge conflicts --- .github/workflows/cherry-pick-rc-to-develop.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cherry-pick-rc-to-develop.yml b/.github/workflows/cherry-pick-rc-to-develop.yml index 5cba37b36ff..ad589f467ca 100644 --- a/.github/workflows/cherry-pick-rc-to-develop.yml +++ b/.github/workflows/cherry-pick-rc-to-develop.yml @@ -119,7 +119,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 }}" @@ -138,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"