mirror of
https://github.com/Sea-Haven-Industries/.github.git
synced 2026-09-30 07:03:11 +00:00
fix(ci): link autofix commits to the bot account (#148)
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:
parent
61f15d78b5
commit
2e2b3a282f
1 changed files with 10 additions and 2 deletions
12
.github/workflows/ci-autofix.yaml
vendored
12
.github/workflows/ci-autofix.yaml
vendored
|
|
@ -258,7 +258,7 @@ jobs:
|
|||
SKIP_BOT: ${{ steps.skip-bot.outputs.skip }}
|
||||
HEAD_REF: ${{ github.head_ref }}
|
||||
APP_SLUG: ${{ steps.app-token.outputs.app-slug }}
|
||||
APP_ID: ${{ secrets.AUTOFMT_APP_ID }}
|
||||
APP_TOKEN: ${{ steps.app-token.outputs.token }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
|
|
@ -272,8 +272,16 @@ jobs:
|
|||
exit 1
|
||||
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.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
|
||||
echo "Tree is clean; no formatter commit."
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue