Repository navigation
👷 ci(release): mint app tokens instead of a PAT - #3301
Merged
Merged
Conversation
gaborbernat
force-pushed
the
ci/release-app-token
branch
2 times, most recently
from
September 23, 2026 00:18
1382420 to
58af853
Compare
gaborbernat
force-pushed
the
ci/release-app-token
branch
4 times, most recently
from
September 23, 2026 01:20
95cb218 to
0639f75
Compare
Pre-release and release authenticate with GH_RELEASE_TOKEN, a long-lived personal access token that pushes to main through the admin ruleset bypass and writes to pypa/get-virtualenv. Anyone holding a leaked copy keeps the owner's access until a maintainer revokes it. Each job mints a GitHub App installation token scoped to the repository it writes and to write access on contents, and create-github-app-token revokes the token when the job ends. The pre-release commit takes its git identity from the app bot user, because an installation token cannot read /user. The steps identify the app by its Client ID, since the action deprecates app-id. The app token pushes the release commit and tag, so the pre-release job holds read access on contents for GITHUB_TOKEN, which setup-uv uses to download uv. The app has no admin role on get-virtualenv. Its main branch requires signed commits and rejects force pushes, so the release job builds the commit through the Git Data API, where GitHub signs it as the app, and moves main with a force=false ref update.
gaborbernat
force-pushed
the
ci/release-app-token
branch
from
September 23, 2026 01:27
0639f75 to
06f60a1
Compare
gaborbernat
marked this pull request as ready for review
September 23, 2026 01:43
This was referenced Sep 23, 2026
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.
pre-release.yamlandrelease.yamlauthenticate withGH_RELEASE_TOKEN, a long-lived personal access token. Pre-release uses it to push the release commit and tag tomainthrough the admin bypass on the rulesets, and to read/userfor the git identity. The publish job uses it to push the new zipapp topypa/get-virtualenv. 🔑 Anyone holding a leaked copy keeps the owner's access until a maintainer revokes it.Each job mints a GitHub App installation token with
actions/create-github-app-token, scoped throughownerandrepositoriesto the repository it writes (virtualenvorget-virtualenv) and topermission-contents: write. The steps identify the app throughclient-id, sincecreate-github-app-tokenv3.2.0 deprecatesapp-id, and the action revokes the token when the job ends. Pre-release takes its git identity from the app bot user (<slug>[bot]with<id>+<slug>[bot]@users.noreply.github.com), because an installation token cannot read/user. The app token pushes the release commit and tag, so the pre-release job'sGITHUB_TOKENdrops fromcontents: writetocontents: read, whichsetup-uvuses to download uv.get-virtualenvprotectsmainwith required signatures. GitHub accepts unsigned pushes from the PAT because its owner is an admin andenforce_adminsis off. The app has no admin role, and a ruleset there blocks force pushes, so the publish job dropsgit push. It creates the blob, tree and commit through the Git Data API without custom author or committer fields, and GitHub signs the commit as the app. The job movesmainwith aPATCHon the ref andforce=false, so the update must fast-forward.pypa/virtualenvandpypa/get-virtualenv; theRELEASE_APP_CLIENT_IDandRELEASE_APP_PRIVATE_KEYsecrets in thereleaseenvironment; and the app as a bypass actor on thedefaultandprotect-release-tagsrulesets ofpypa/virtualenv. We revoke theGH_RELEASE_TOKENPAT after the first release that uses the app.