History

Use GitHub App token when checking out main in release workflow (#1175)

Julius Marminge committed 8 months ago

Commit 55560f51 parent 3710ddb1 file · +22 −2Browse files

Showing the changes to .github (1 of 1 file). Show all

Unified · Split

.github/workflows/release.yml+22−2
@@ -308,11 +308,31 @@ jobs: · 307 unmodified lines
308308 needs: [preflight, release]
309309 runs-on: ubuntu-24.04
310310 steps:
311+ - id: app_token
312+ name: Mint release app token
313+ uses: actions/create-github-app-token@v2
314+ with:
315+ app-id: ${{ vars.RELEASE_APP_ID }}
316+ private-key: ${{ secrets.RELEASE_APP_PRIVATE_KEY }}
317+ owner: ${{ github.repository_owner }}
318+
311319 - name: Checkout
312320 uses: actions/checkout@v6
313321 with:
314322 ref: main
315323 fetch-depth: 0
324+ token: ${{ steps.app_token.outputs.token }}
325+ persist-credentials: true
326+
327+ - id: app_bot
328+ name: Resolve GitHub App bot identity
329+ env:
330+ GH_TOKEN: ${{ steps.app_token.outputs.token }}
331+ APP_SLUG: ${{ steps.app_token.outputs.app-slug }}
332+ run: |
333+ user_id="$(gh api "/users/${APP_SLUG}[bot]" --jq .id)"
334+ echo "name=${APP_SLUG}[bot]" >> "$GITHUB_OUTPUT"
335+ echo "email=${user_id}+${APP_SLUG}[bot]@users.noreply.github.com" >> "$GITHUB_OUTPUT"
316336
317337 - name: Setup Bun
318338 uses: oven-sh/setup-bun@v2
@@ -349,8 +369,8 @@ jobs: · 30 unmodified lines
349369 exit 0
350370 fi
351371
352− git config user.name "github-actions[bot]"
353− git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
372+ git config user.name "${{ steps.app_bot.outputs.name }}"
373+ git config user.email "${{ steps.app_bot.outputs.email }}"
354374
355375 git add apps/server/package.json apps/desktop/package.json apps/web/package.json packages/contracts/package.json bun.lock
356376 git commit -m "chore(release): prepare $RELEASE_TAG"