Repository navigation
feat: add app-token action for GitHub App tokens - #5
Merged
Merged
Conversation
Read the App key from a repository secret, AWS SSM or GCP Secret Manager with one action. read-ssm-token.sh now masks multi-line values line by line and can use the runner's own AWS credentials.
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
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.
What
app-token/action.yaml: one action that returns a GitHub App installation token, with the App's client ID and private key from exactly one source:client_id+private_key(a repository variable and secret);client_id_ssm_parameter+private_key_ssm_parameter, read withaws_role_arn(the job's OIDC token) or, without a role, with the runner's own AWS credentials (an EC2 instance profile);gcp_wif_provider,gcp_service_account,gcp_project_id,client_id_gcp_secret,private_key_gcp_secret(Workload Identity Federation, then Secret Manager).owner(defaultgenlayerlabs) andrepositoriespass through. Output:token.actions/create-github-app-tokenv3.3.0,google-github-actions/authv3.0.0,google-github-actions/get-secretmanager-secretsv3.0.0.support/scripts/read-ssm-token.sh:ROLE_ARNuses the runner's own AWS credentials (exit 3 only applies with a role);github-actions-<run id>(no IAM policy conditions on it), and a placeholder message that is not cache-specific.README.mdanddocs/using/actions.md: the action, an example, the inputs and notes.Why
The same App key is read four ways today: genlayer-e2e's
gcp-app-tokenandaws-app-token(picked per job with two steps and||), genlayer-node's vendored copy ofgcp-app-token, and genlayer-cli / genlayer-js callinggenlayer-e2e/.github/actions/gcp-app-token@main. A fix or a key rotation has to land in each. This puts the logic in one place; consumers move to it in their own PRs. genlayer-heartbeat is the first: its release and deploy PRs need an App token so their CI runs (key in its own secrets, the direct source).Tests
Step script extracted from the action and run with a stub
aws:client_idprivate_keymissing (fork note)source=direct, no key written to outputsid-token: writeCHANGE_ME/ missing parametersource=gcpread-ssm-token.shwith stubcurl/aws, role mode, multi-line value: before this change only the first line is masked and the rest prints in the clear; after, every line is masked. The role path still reads with the assumed credentials, sonix-setup/nix-cache-pushare unchanged.shellcheckclean (script and the action's bash steps);nix flake checkpasses.Not run yet: a real token. Next, a throwaway genlayer-heartbeat workflow calls
app-token@feat/app-tokenwith the direct source before merge. The aws and gcp sources get their first live run in the first consumer that uses them.