Skip to content

Commit

Permalink
[ci][backport-pr] Fetch all commits, configure git author
Browse files Browse the repository at this point in the history
gherrit-pr-id: I8c3db36d20b511c31ec774db68896f2fe4b539bb
  • Loading branch information
joshlf committed Nov 5, 2024
1 parent 3d5a8a6 commit db24a7b
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions .github/workflows/backport-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,33 @@ jobs:
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: ${{ github.event.inputs.target_branch }}
# Check out the entire repository so that the target commit is checked
# out (by default, only fetches the single commit identified by the
# `ref` argument).
fetch-depth: 0
persist-credentials: false
- name: Cherry-pick commit
run: |
set -eo pipefail
AUTHOR_NAME="$(git log -1 --pretty='%an' ${{ github.event.inputs.commit }})"
AUTHOR_EMAIL="$(git log -1 --pretty='%ae' ${{ github.event.inputs.commit }})"
git config --global user.name "$AUTHOR_NAME"
git config --global user.email "$AUTHOR_EMAIL"
git cherry-pick ${{ github.event.inputs.commit }}
PR_TITLE="$(git log -1 --pretty=%s)"
echo "PR_TITLE=$PR_TITLE" >> $GITHUB_ENV
AUTHOR="$(git log -1 --pretty='%an <%ae>')"
AUTHOR="$AUTHOR_NAME <$AUTHOR_EMAIL>"
echo "AUTHOR=$AUTHOR" >> $GITHUB_ENV
- name: Submit PR
uses: peter-evans/create-pull-request@5e914681df9dc83aa4e4905692ca88beb2f9e91f # v7.0.5
with:
author: "${{ env.AUTHOR }}"
author: Google PR Creation Bot <github-pull-request-creation-bot@google.com>
committer: "${{ env.AUTHOR }}"
title: "${{ env.PR_TITLE }}"
branch: backport-${{ github.event.inputs.commit }}
Expand Down

0 comments on commit db24a7b

Please sign in to comment.