@@ -106,15 +106,24 @@ jobs:
106106 git fetch origin "$TARGET_BRANCH"
107107 git checkout -b "$NEW_BRANCH" "origin/$TARGET_BRANCH"
108108
109+ # If PR_TITLE starts with "[", don't insert an extra space.
110+ if [ "${PR_TITLE:0:1}" = "[" ]; then
111+ NEW_TITLE="[Cherry-Pick]$PR_TITLE(#$PR_NUMBER)"
112+ else
113+ NEW_TITLE="[Cherry-Pick] $PR_TITLE(#$PR_NUMBER)"
114+ fi
115+
109116 # Cherry pick
110117 # Try standard cherry-pick first (for squash merges or single commits)
111118 if git cherry-pick "$MERGE_COMMIT_SHA"; then
112119 echo "Cherry-pick successful."
120+ git commit --amend -m "$NEW_TITLE"
113121 else
114122 echo "Standard cherry-pick failed, trying with -m 1 (for merge commits)..."
115123 git cherry-pick --abort
116124 if git cherry-pick -m 1 "$MERGE_COMMIT_SHA"; then
117125 echo "Cherry-pick with -m 1 successful."
126+ git commit --amend -m "$NEW_TITLE"
118127 else
119128 echo "Cherry-pick failed."
120129 git cherry-pick --abort
@@ -135,13 +144,6 @@ jobs:
135144 git push "$FORK_URL_AUTH" "$NEW_BRANCH" --force
136145
137146 # Create PR
138- # If PR_TITLE starts with "[", don't insert an extra space.
139- if [ "${PR_TITLE:0:1}" = "[" ]; then
140- NEW_TITLE="[Cherry-Pick]$PR_TITLE(#$PR_NUMBER)"
141- else
142- NEW_TITLE="[Cherry-Pick] $PR_TITLE(#$PR_NUMBER)"
143- fi
144-
145147 NEW_BODY="Cherry-pick of #$PR_NUMBER (authored by @${PR_AUTHOR}) to \`$TARGET_BRANCH\`.
146148
147149 devPR:https://github.com/PaddlePaddle/FastDeploy/pull/$PR_NUMBER <!-- For pass CI -->
0 commit comments