fix(ci): link autofix commits to the bot account (#148)
Some checks are pending
ci / ci / ci (push) Waiting to run
Release on reusable change / version (push) Waiting to run
Release on reusable change / release (push) Blocked by required conditions

Use the bot account id in the noreply email so GitHub attaches the
app logo. The App id prefix pushes a commit that stays unlinked.
This commit is contained in:
Adam Moussa 2026-09-23 20:15:19 -04:00 • committed by GitHub
parent 61f15d78b5
commit 2e2b3a282f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -258,7 +258,7 @@ jobs:
SKIP_BOT: ${{ steps.skip-bot.outputs.skip }} SKIP_BOT: ${{ steps.skip-bot.outputs.skip }}
HEAD_REF: ${{ github.head_ref }} HEAD_REF: ${{ github.head_ref }}
APP_SLUG: ${{ steps.app-token.outputs.app-slug }} APP_SLUG: ${{ steps.app-token.outputs.app-slug }}
APP_ID: ${{ secrets.AUTOFMT_APP_ID }} APP_TOKEN: ${{ steps.app-token.outputs.token }}
run: | run: |
set -euo pipefail set -euo pipefail
@ -272,8 +272,16 @@ jobs:
exit 1 exit 1
fi fi
# The noreply local-part must be the bot account id, not the App id.
# An App-id prefix still pushes, but GitHub does not link the commit
# to the bot, so the app logo is not used.
bot_id=$(curl -fsSL \
-H "Authorization: Bearer ${APP_TOKEN}" \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
"https://api.github.com/users/${APP_SLUG}%5Bbot%5D" | jq -er '.id')
git config user.name "${APP_SLUG}[bot]" git config user.name "${APP_SLUG}[bot]"
git config user.email "${APP_ID}+${APP_SLUG}[bot]@users.noreply.github.com" git config user.email "${bot_id}+${APP_SLUG}[bot]@users.noreply.github.com"
if [ -z "$(git status --porcelain)" ]; then if [ -z "$(git status --porcelain)" ]; then
echo "Tree is clean; no formatter commit." echo "Tree is clean; no formatter commit."