fix: authenticate the metadata-update PR as the bot account, not GITHUB_TOKEN - #434
Merged
Conversation
…UB_TOKEN GitHub now requires a maintainer to approve workflow runs on PRs opened with the repository's own GITHUB_TOKEN (June 2026 change), which blocks unattended auto-merge - confirmed by testing against the real v9.0.38 PR. Fine-grained PATs can't be scoped to a repo the token's account only collaborates on (not owns), so this uses a classic PAT (BOT_ACCESS_TOKEN, public_repo scope) from a dedicated libphonenumber-csharp-bot account instead: actions/checkout's token and the script's GITHUB_TOKEN both switch to it, so the push and the PR authenticate as that account rather than github-actions[bot]. The job no longer needs its own elevated permissions since GITHUB_TOKEN isn't used for any write in this job anymore. finalize_metadata_release.yml's trigger condition checked github.event.pull_request.user.login == 'github-actions[bot]' as an anti-spoofing guard - updated to the bot account's login, since the PR's author identity changes with this fix. Without this it would never fire again.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #434 +/- ##
=======================================
Coverage 87.26% 87.26%
=======================================
Files 41 41
Lines 3831 3831
Branches 978 978
=======================================
Hits 3343 3343
Misses 284 284
Partials 204 204 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This was referenced Aug 28, 2026
Closed
Open
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
GITHUB_TOKEN(a June 2026 platform change) — confirmed against real runs on the v9.0.38 metadata PR, which sat inaction_requiredfor all 5 required checks despite the PR being entirely automation-authored. That blocks unattended auto-merge, defeating the point of the PR+auto-merge rework.create_new_release_on_new_metadata_update.ymlto a classic PAT (BOT_ACCESS_TOKENsecret,public_reposcope) generated from a dedicatedlibphonenumber-csharp-botaccount. Bothactions/checkout'stokenand the script'sGITHUB_TOKENenv var now use that secret, so the push and the PR authenticate as the bot account instead ofgithub-actions[bot].permissions:block drops back to the file-levelcontents: readdefault — nothing in the job writes via the defaultGITHUB_TOKENanymore, so there's no reason to mint an elevated one.finalize_metadata_release.yml's trigger condition checkedgithub.event.pull_request.user.login == 'github-actions[bot]'as an anti-spoofing guard (only that identity should be able to trigger a release). Updated to'libphonenumber-csharp-bot'— without this the workflow would silently stop firing once the PR's author identity changed, and metadata PRs would merge but never get tagged/released/published.README.md's "Metadata updates" section notes the bot identity and why.Testing
shellcheck -x -S warningon all threelib/*.shscripts (unchanged in this PR, re-checked for safety) — clean.github-actions[bot]orGITHUB_TOKENin this flow that would need updating alongside —finalize_metadata_release.yml's ownGITHUB_TOKENusage (for creating the release and dispatching the NuGet publish) is intentionally left as the default token, since that workflow triggers onpull_request: closedrather than opening a PR itself, so it was never subject to the approval gate.Requires the
BOT_ACCESS_TOKENrepository secret to already exist (it does) and thelibphonenumber-csharp-botaccount to have write collaborator access (it does).Generated by Claude Code