7575 env :
7676 GH_TOKEN : ${{ github.token }}
7777 COMMIT_MESSAGE : ${{ steps.commit.outputs.commit_message }}
78+ COMMIT_AUTHOR : ${{ steps.commit.outputs.author }}
79+ COMMIT_AUTHOR_EMAIL : ${{ steps.commit.outputs.author_email }}
80+ COMMIT_LABELS : ${{ steps.commit.outputs.labels }}
7881 run : |
7982 target_milestone=$(gh pr view ${{ steps.commit.outputs.pr_number }} --json milestone --jq .milestone.title)
8083
@@ -114,9 +117,9 @@ jobs:
114117 --arg message "$COMMIT_MESSAGE" \
115118 --arg pr "${{ steps.commit.outputs.pr_number }}" \
116119 --arg release "${{ steps.commit.outputs.latest_release }}" \
117- --arg author "${{ steps.commit.outputs.author }} " \
118- --arg email "${{ steps.commit.outputs.author_email }} " \
119- --arg labels "${{ steps.commit.outputs.labels }} " \
120+ --arg author "$COMMIT_AUTHOR " \
121+ --arg email "$COMMIT_AUTHOR_EMAIL " \
122+ --arg labels "$COMMIT_LABELS " \
120123 '. += [{
121124 commit: $commit,
122125 target_branch: $branch,
@@ -132,9 +135,15 @@ jobs:
132135 echo "result=$result" >> $GITHUB_OUTPUT
133136 - name : Save result to file
134137 if : ${{ steps.commit.outputs.pr_number }}
138+ env :
139+ # Per-target backport entries (commit, target branch, commit
140+ # message, author, ...). The embedded commit message and author may
141+ # contain quotes -- inline ${{ }} interpolation into the shell
142+ # breaks on them (e.g. an apostrophe in the PR title).
143+ BACKPORT_TARGETS_JSON : ${{ steps.milestones.outputs.result }}
135144 run : |
136145 mkdir -p /tmp/backport-results
137- echo '${{ steps.milestones.outputs.result }}' > /tmp/backport-results/${{ matrix.commits }}.json
146+ printf '%s' "$BACKPORT_TARGETS_JSON" > /tmp/backport-results/${{ matrix.commits }}.json
138147 - name : Upload result artifact
139148 if : ${{ steps.commit.outputs.pr_number }}
140149 uses : actions/upload-artifact@v4
@@ -185,9 +194,11 @@ jobs:
185194 - name : Cherry-pick
186195 env :
187196 COMMIT_MESSAGE : ${{ matrix.commit_message }}
197+ COMMIT_AUTHOR : ${{ matrix.author }}
198+ COMMIT_AUTHOR_EMAIL : ${{ matrix.author_email }}
188199 run : |
189- git config user.name "${{ matrix.author }} "
190- git config user.email "${{ matrix.author_email }} "
200+ git config user.name "$COMMIT_AUTHOR "
201+ git config user.email "$COMMIT_AUTHOR_EMAIL "
191202 target_commit="${{ matrix.commit }}"
192203 git fetch origin main "$target_commit"
193204 git cherry-pick --strategy=recursive --strategy-option=theirs "$target_commit"
0 commit comments