Skip to content

Secrets

The platform-infra repo pushes GitHub Actions CI secrets out to the Patina-Network org and to individual repositories within the org. Values are stored SOPS-encrypted in platform-infra; Pulumi decrypts them at apply time and reconciles the state onto the GitHub secrets platform.

Currently supported:

  • Org-wide Actions secrets: visible to every repo in Patina-Network.
  • Repo-scoped Actions secrets: visible only to a single repo.

Not supported:

  • Environment-scoped secrets

Adding an org-wide CI secret

Org secrets are visible to every repo under Patina-Network.

  1. Edit the encrypted file:
just edit src/github/organization/secrets.yaml
  1. Add a key/value pair inside the editor:
MY_ORG_SECRET: "the-value"
  1. Save and close. sops re-encrypts on save.

  2. Open a PR

  3. CI's preview job will show a new ActionsOrganizationSecret in the diff. CD applies it on merge + tag.

Adding a repo-scoped CI secret

Repo secrets are visible to exactly one repo. The file name must match the repository key in src/github/repositories/inputs.ts (e.g. codebloom, patchats, dockerfiles).

Note

If the file name doesn't match a repo key in REPOSITORIES, pulumi preview will fail with a clear error. Rename the file or add the repo to REPOSITORIES first.

  1. Open the encrypted file.
  2. First time for a repo

    create the file, then encrypt it in place:

    touch src/github/repositories/secrets/<repo-name>.yaml
    # add a key, e.g. `MY_REPO_SECRET: the-value`
    just encrypt src/github/repositories/secrets/<repo-name>.yaml
    
  3. Subsequent edits

    use just edit:

    just edit src/github/repositories/secrets/<repo-name>.yaml
    

    Add a key/value pair inside the editor:

    MY_REPO_SECRET: "the-value"
    

    Save & close, sops re-encrypts on save.

  4. Open a PR

  5. CI's preview job will show a new ActionsSecret in the diff. CD applies it on merge + tag.

What ends up on GitHub

File GitHub resource Visibility
src/github/organization/secrets.yaml github.ActionsOrganizationSecret all (every repo in the org)
src/github/repositories/secrets/<repo>.yaml github.ActionsSecret Only that repo

Values are pushed to GitHub via libsodium sealed-box encryption. Pulumi marks the plaintext as sensitive, so it does not appear in pulumi preview diffs or the PR preview comment.

Rotating or removing a secret

  • Rotate: just edit <file>, change the value, preview + merge.
  • Remove: just edit <file>, delete the key, preview + merge.

Pulumi will delete the corresponding secret from GitHub.

Reading a secret in a pipeline

Two ways to read a secret in a workflow.

Already loaded by the shared setup action. tahminator/pipeline/actions/setup takes a SECRETS input (${{ toJSON(secrets) }}) and exposes every secret as a masked environment variable for the rest of the job:

- name: Setup
  uses: tahminator/pipeline/actions/setup@4ee08420b0e0e291761d9c7d5e3983f5b3abbd39 # 1.0.88
  with:
    SECRETS: ${{ toJSON(secrets) }}

- name: Use it
  run: bun run .github/scripts/src/my-script
// .github/scripts/src/my-script/index.ts
const secretToken = process.env.MY_SECRET;

stealThePlanet(secretToken);

Directly in workflow YAML. ${{ secrets.MY_SECRET }} works anywhere in the workflow file itself, no setup step required:

- name: Use it
  uses: example@v4
  with:
    secret: ${{ secrets.MY_SECRET }}

Reaching the private cluster (Headscale/Tailscale)

Jobs that need to reach the internal network (e.g. databases, specific services) can do so via the pipeline setup action workflow.

Warning

Only wire them into jobs that actually need private network access.

If you aren't sure whether you need it or not, reach out to someone on the @Patina-Network/infra team

  • HEADSCALE_ADDRESS
  • HEADSCALE_USER
  • HEADSCALE_PREAUTHKEY
- name: Setup
  uses: tahminator/pipeline/actions/setup@4ee08420b0e0e291761d9c7d5e3983f5b3abbd39 # 1.0.88
  with:
    SECRETS: ${{ toJSON(secrets) }}
    # all Patina-Network repos have these 3 secrets already
    HEADSCALE_ADDRESS: ${{ secrets.HEADSCALE_ADDRESS }}
    HEADSCALE_USER: ${{ secrets.HEADSCALE_USER }}
    HEADSCALE_PREAUTHKEY: ${{ secrets.HEADSCALE_PREAUTHKEY }}

Passing any of the three enables Headscale support for that job.

Code

logic lives in: