Skip to content

Commit d07b5b1

Browse files
authored
fix(workflow): set github actor as commit author (#277)
1 parent 055c1b5 commit d07b5b1

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

.github/workflows/publish.yaml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -234,16 +234,26 @@ jobs:
234234
235235
# Set committer to the GitHub Actions bot
236236
# https://github.com/orgs/community/discussions/26560#discussioncomment-3531273
237-
git config user.name "github-actions[bot]"
238-
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
237+
COMMITTER_NAME="github-actions[bot]"
238+
COMMITTER_EMAIL="41898282+github-actions[bot]@users.noreply.github.com"
239+
240+
# Set the author to the actor of this workflow. Use the github-provided
241+
# noreply email address: https://docs.github.com/en/account-and-profile/setting-up-and-managing-your-personal-account-on-github/managing-email-preferences/setting-your-commit-email-address.
242+
AUTHOR_NAME="${{ github.actor }}"
243+
AUTHOR_EMAIL="${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com"
239244
240245
# Use an authorized remote url to push to the fork
241246
git remote add authed-fork https://x-access-token:${{ secrets.publish_token }}@github.com/${{ inputs.registry_fork }}.git
242247
243248
BRANCH="${{ steps.create-final-entry.outputs.module-names }}-${{ inputs.tag_name }}"
244249
git checkout -b "${BRANCH}"
245250
git add .
246-
git commit -m "${{ steps.create-final-entry.outputs.short-description }}"
251+
git -c "author.name=${AUTHOR_NAME}" \
252+
-c "author.email=${AUTHOR_EMAIL}" \
253+
-c "committer.name=${COMMITTER_NAME}" \
254+
-c "committer.email=${COMMITTER_EMAIL}" \
255+
commit \
256+
-m "${{ steps.create-final-entry.outputs.short-description }}"
247257
git push --force authed-fork "${BRANCH}"
248258
249259
echo "branch=${BRANCH}" >> $GITHUB_OUTPUT

0 commit comments

Comments
 (0)