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
308 needs: [preflight, release]308 needs: [preflight, release]
309 runs-on: ubuntu-24.04309 runs-on: ubuntu-24.04
310 steps:310 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
311 - name: Checkout319 - name: Checkout
312 uses: actions/checkout@v6320 uses: actions/checkout@v6
313 with:321 with:
314 ref: main322 ref: main
315 fetch-depth: 0323 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"
316 336
317 - name: Setup Bun337 - name: Setup Bun
318 uses: oven-sh/setup-bun@v2338 uses: oven-sh/setup-bun@v2
@@ -349,8 +369,8 @@ jobs: · 30 unmodified lines
349 exit 0369 exit 0
350 fi370 fi
351 371
352 git config user.name "github-actions[bot]"372 git config user.name "${{ steps.app_bot.outputs.name }}"
353 git config user.email "41898282+github-actions[bot]@users.noreply.github.com"373 git config user.email "${{ steps.app_bot.outputs.email }}"
354 374
355 git add apps/server/package.json apps/desktop/package.json apps/web/package.json packages/contracts/package.json bun.lock375 git add apps/server/package.json apps/desktop/package.json apps/web/package.json packages/contracts/package.json bun.lock
356 git commit -m "chore(release): prepare $RELEASE_TAG"376 git commit -m "chore(release): prepare $RELEASE_TAG"