Skip to content

feat: add app-token action for GitHub App tokens - #5

Merged
dohernandez merged 1 commit into
mainfrom
feat/app-token
Nov 13, 2026
Merged

dohernandez merged 1 commit into
mainfrom
feat/app-token

Conversation

@dohernandez

Copy link
Copy Markdown
Member

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:
    • direct: client_id + private_key (a repository variable and secret);
    • aws: client_id_ssm_parameter + private_key_ssm_parameter, read with aws_role_arn (the job's OIDC token) or, without a role, with the runner's own AWS credentials (an EC2 instance profile);
    • gcp: gcp_wif_provider, gcp_service_account, gcp_project_id, client_id_gcp_secret, private_key_gcp_secret (Workload Identity Federation, then Secret Manager).
    • The source is the group of inputs that has a value; two sources, or part of one, fail the job and name what is missing. owner (default genlayerlabs) and repositories pass through. Output: token.
    • Third-party actions pinned by commit: actions/create-github-app-token v3.3.0, google-github-actions/auth v3.0.0, google-github-actions/get-secretmanager-secrets v3.0.0.
  • support/scripts/read-ssm-token.sh:
    • masks the value line by line. It masked a multi-line value as one line, which leaves every line after the first readable in the log; harmless for today's one-line cache tokens, a leak for a private key;
    • an empty ROLE_ARN uses the runner's own AWS credentials (exit 3 only applies with a role);
    • session name github-actions-<run id> (no IAM policy conditions on it), and a placeholder message that is not cache-specific.
  • README.md and docs/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-token and aws-app-token (picked per job with two steps and ||), genlayer-node's vendored copy of gcp-app-token, and genlayer-cli / genlayer-js calling genlayer-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:

Case Result
no source / direct + aws error naming the sources
direct with only client_id error: private_key missing (fork note)
direct full source=direct, no key written to outputs
aws, runner credentials both values in outputs (random delimiters), every key line masked
aws, role but no OIDC token error: add id-token: write
aws, CHANGE_ME / missing parameter error with the reason
gcp partial / full error listing the missing inputs / source=gcp

read-ssm-token.sh with stub curl / 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, so nix-setup / nix-cache-push are unchanged.

shellcheck clean (script and the action's bash steps); nix flake check passes.

Not run yet: a real token. Next, a throwaway genlayer-heartbeat workflow calls app-token@feat/app-token with the direct source before merge. The aws and gcp sources get their first live run in the first consumer that uses them.

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.
@coderabbitai

coderabbitai Bot commented Nov 13, 2026

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 73ec05ee-b54e-46dd-8bc1-9bf0caa16d0c
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@dohernandez
dohernandez merged commit 03ff74e into main Nov 13, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant