Skip to content

ci: replace PATs with GITHUB_TOKEN in CI workflows#6073

Merged
Fedr merged 4 commits into
masterfrom
ci/github-token-migration
May 9, 2026
Merged

ci: replace PATs with GITHUB_TOKEN in CI workflows#6073
Fedr merged 4 commits into
masterfrom
ci/github-token-migration

Conversation

@Grantim
Copy link
Copy Markdown
Contributor

@Grantim Grantim commented May 8, 2026

Summary

  • Replace BUILD_MACHINE_TOKEN and MESHINSPECTOR_BOT_TOKEN with the built-in GITHUB_TOKEN for all same-repo GitHub operations
  • Add permissions: contents: write to workflows that create/update releases or tags
  • Switch gh CLI authentication from gh auth login --with-token piping to the GH_TOKEN env-var pattern
  • Remove BUILD_MACHINE_TOKEN from on.workflow_call.secrets declarations where it is no longer used

Intentionally unchanged (PATs still required):

  • vcpkg-auto-update.ymlMESHINSPECTOR_BOT_VCPKG_UPDATE_TOKEN: pushes branches that must trigger CI (GITHUB_TOKEN pushes do not trigger workflows)
  • pot-auto-update.yml — same token, same reason
  • update-docs.ymlMESHINSPECTOR_BOT_TOKEN: cross-repo checkout (MeshInspector/MeshInspector.github.io)

Files changed

  • versioning-release.ymlGITHUB_TOKEN: ${{ github.token }} in mikepenz/action-gh-release; added permissions: contents: write
  • distro-release.yml — replaced gh auth login with env: GH_TOKEN: ${{ github.token }}; added permissions: contents: write
  • release-body-update.yml — same pattern; added permissions: contents: write
  • unity-nuget-test.yml — removed BUILD_MACHINE_TOKEN secret declaration; use github.token
  • build-test-distribute.yml — changed permissions: contents: read → write; removed PAT secret passing to callee workflows; replaced gh auth login with GH_TOKEN env var

Test plan

  • Checkout step completes (no HTTP 403 for MeshLib submodule — it's public)
  • Windows build passes (token used for checkout)
  • Ubuntu x64 build passes (token used for checkout)
  • Verify vcpkg-auto-update and pot-auto-update still reference bot token (no regression)

🤖 Generated with Claude Code

Switch all same-repo GitHub operations from manually managed PATs to the
built-in GITHUB_TOKEN: checkout, release create/upload, tag creation, and
gh CLI calls. Add permissions: contents: write where needed. PATs that
require cross-repo access or bot-triggered CI (vcpkg-auto-update,
pot-auto-update, update-docs) are intentionally unchanged.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Grantim and others added 2 commits May 8, 2026 13:58
\${{ github.token }} doesn't expand when used in the secrets: block of a
reusable workflow call — the receiving secret comes through empty,
causing 'echo  | gh auth login --with-token' to fail. Use the
canonical \${{ secrets.GITHUB_TOKEN }} form instead.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@Fedr Fedr merged commit a8b9486 into master May 9, 2026
47 checks passed
@Fedr Fedr deleted the ci/github-token-migration branch May 9, 2026 13:37
Fedr added a commit that referenced this pull request May 9, 2026
… releases (#6081)

PR #6073 swapped BUILD_MACHINE_TOKEN for github.token in the unity nuget
test, but unity-nuget-test.yml still declared contents:read at the
workflow level. The .nupkg lives on a draft release, and GitHub only
lists draft releases for callers with push (write) access — so
`gh release download <tag>` now returns "release not found" against the
draft, breaking the scheduled run.

Bump the workflow permission to contents:write to match the other
workflows updated in #6073.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants