feat: support GitHub App token sources for state and release tokens#240
Merged
Conversation
Signed-off-by: Joshua Temple <joshua.temple@stablekernel.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.
Problem
release_token/state_tokenaccept only a static secret expression. A static secret works for a PAT, but a GitHub App identity is the better fit for a protected trunk: it is owned by an org (survives a person rotating a PAT or leaving), mints a per-run token that expires in about an hour (no long-lived push-capable secret on the trunk, only the App private key is stored), and can be added directly to a ruleset bypass list. Closes #97 and #6.Fix
Add optional, additive sibling fields
release_token_appandstate_token_appon the trunk config, each anAppTokenSource{ app_id, private_key }carrying secret REFERENCES (never raw key material). When a seam has an App source, the generator emits anactions/create-github-app-tokenminting step before the consuming steps and rewires consumers to the minted output; otherwise behavior is unchanged.app_idandprivate_keyare required and must be secret-reference shaped; raw key material (a newline or thePRIVATE KEYmarker) is rejected. Lenient on absence.schema_versionis not bumped (stays 1). All threemanifest.schema.jsoncopies regenerated and byte-identical.Pin added:
actions/create-github-app-token@v3(shabcd2ba49218906704ab6c1aa796996da409d3eb1, v3.2.0), via the existing pin registry so pin policy applies uniformly.act/gitea fallback
The minting action has no GitHub App under act/gitea, so the mint step is guarded by
if: ${{ github.server_url == 'https://github.com' }}(matching the existing real-vs-gitea split that keys onGITHUB_SERVER_URL). Consumers reference${{ steps.<mint-id>.outputs.token || <static-fallback> }}: on gitea the skipped step's empty output falls through to the static token, so the e2e harness stays green without configuring an App source.Verification
TestPlan_MatchesGeneratedBytes, determinism, and all goldens stay green.create-github-app-tokenuses + if-guard + fallback ref) including an actionlint pass.30-app-token-sourceproves the act path is unaffected (no-App manifest regenerates with no drift) and an App-source manifest parses/validates with the act fallback keeping the workflow runnable.go build,go test ./...,golangci-lint run ./..., and the e2e module build/vet all pass.