Skip to content

Commit db24a7b

Browse files
committed
[ci][backport-pr] Fetch all commits, configure git author
gherrit-pr-id: I8c3db36d20b511c31ec774db68896f2fe4b539bb
1 parent 3d5a8a6 commit db24a7b

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

.github/workflows/backport-pr.yml

+14-3
Original file line numberDiff line numberDiff line change
@@ -29,22 +29,33 @@ 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
4556
uses: peter-evans/create-pull-request@5e914681df9dc83aa4e4905692ca88beb2f9e91f # v7.0.5
4657
with:
47-
author: "${{ env.AUTHOR }}"
58+
author: Google PR Creation Bot <github-pull-request-creation-bot@google.com>
4859
committer: "${{ env.AUTHOR }}"
4960
title: "${{ env.PR_TITLE }}"
5061
branch: backport-${{ github.event.inputs.commit }}

0 commit comments

Comments
 (0)