Skip to content

Commit 375c032

Browse files
authored
[ci][backport-pr] Fetch all commits, configure git author (#2018)
gherrit-pr-id: I8c3db36d20b511c31ec774db68896f2fe4b539bb
1 parent 3d5a8a6 commit 375c032

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

.github/workflows/backport-pr.yml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,27 @@ jobs:
2929
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
3030
with:
3131
ref: ${{ github.event.inputs.target_branch }}
32+
# Check out the entire repository so that the target commit is checked
33+
# out (by default, only fetches the single commit identified by the
34+
# `ref` argument).
35+
fetch-depth: 0
3236
persist-credentials: false
3337
- name: Cherry-pick commit
3438
run: |
3539
set -eo pipefail
40+
41+
AUTHOR_NAME="$(git log -1 --pretty='%an' ${{ github.event.inputs.commit }})"
42+
AUTHOR_EMAIL="$(git log -1 --pretty='%ae' ${{ github.event.inputs.commit }})"
43+
44+
git config --global user.name "$AUTHOR_NAME"
45+
git config --global user.email "$AUTHOR_EMAIL"
46+
3647
git cherry-pick ${{ github.event.inputs.commit }}
37-
48+
3849
PR_TITLE="$(git log -1 --pretty=%s)"
3950
echo "PR_TITLE=$PR_TITLE" >> $GITHUB_ENV
4051
41-
AUTHOR="$(git log -1 --pretty='%an <%ae>')"
52+
AUTHOR="$AUTHOR_NAME <$AUTHOR_EMAIL>"
4253
echo "AUTHOR=$AUTHOR" >> $GITHUB_ENV
4354
4455
- name: Submit PR

0 commit comments

Comments
 (0)