diff --git a/.github/workflows/cherry-pick-rc-to-develop.yml b/.github/workflows/cherry-pick-rc-to-develop.yml index 85b512075f7..292afb490cc 100644 --- a/.github/workflows/cherry-pick-rc-to-develop.yml +++ b/.github/workflows/cherry-pick-rc-to-develop.yml @@ -109,6 +109,14 @@ jobs: CHERRY_PICK_COMMIT=$(git rev-parse HEAD) echo "cherryPickCommit=$CHERRY_PICK_COMMIT" >> $GITHUB_ENV + - name: Get Original Author + id: get-author + if: env.shouldCherryPick == 'true' + run: | + ORIGINAL_AUTHOR=$(git log -1 --pretty=format:'%an <%ae>' ${{ github.event.pull_request.merge_commit_sha }}) + echo "Original author: $ORIGINAL_AUTHOR" + echo "originalAuthor=$ORIGINAL_AUTHOR" >> $GITHUB_ENV + - name: Cherry-pick commits id: commit-cherry-pick if: env.shouldCherryPick == 'true' @@ -122,8 +130,10 @@ jobs: 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 }}" + git add . + git commit --author "${{ env.originalAuthor }}" -am "Commit with unresolved merge conflicts outside of ${{ env.SUBMODULE_NAME }}" + else + git commit --author "${{ env.originalAuthor }}" --amend --no-edit fi # Push branch and remove temp @@ -133,6 +143,7 @@ jobs: git branch -D temp-branch-for-cherry-pick fi + - name: Create PR if: env.shouldCherryPick == 'true' env: