ci: release via GitHub App token (prereq for branch protection on main)#17
Merged
Conversation
…tion The default GITHUB_TOKEN cannot be a ruleset bypass actor (confirmed via GitHub docs), so once `main` is protected by required status checks PSR's release commit + tag push would be rejected. Mint a short-lived GitHub App installation token (no long-lived PAT) and use it for both the checkout and PSR's github_token; the App is added to the ruleset's bypass list. PyPI upload stays on OIDC trusted publishing. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Why
We want
mainprotected by required status checks so unformatted / unlinted / failing code can't land. But a branch-protection ruleset would reject python-semantic-release's release commit + tag push — and the defaultGITHUB_TOKENcannot be granted a ruleset bypass (confirmed via GitHub REST docs + PSR docs: the default token is not a valid bypass actor; only a PAT or a GitHub App installation token can bypass).This PR switches the
releasejob to mint a short-lived GitHub App installation token (actions/create-github-app-token@v3.2.0) and use it for bothactions/checkoutand PSR'sgithub_token. No long-lived PAT; PyPI upload stays on OIDC trusted publishing.What changed
release.yml: newMint GitHub App tokenstep; checkout + PSR now push as the App.Required before this is effective — you create the App (I can't)
bim-ba/ycli.RELEASE_APP_CLIENT_ID= the App's Client IDRELEASE_APP_PRIVATE_KEY= the App's generated private key (full PEM)Rollout order (must be this order, or a release breaks)
ci:change → no release triggered, so the new path isn't exercised yet — safe).main(required checkstest (3.12)·test (3.13)·gitleaks; bypass = the App as Integration + repo admin).feat:/fix:release exercises the App token + bypass — watch that first run; rollback = delete the ruleset.🤖 Generated with Claude Code