Skip to content

Organization Codespaces Secret

Definition of a Codespaces Secret on organization level, the following properties are supported:

Key Value Description Note
name string The name of the secret
selected_repositories list[string] List of repositories that can use the secret only applicable if visibility is set to selected
value SecretValue The secret value
visibility string Controls which repositories can use the secret public, private or selected

Codespaces secrets are available as environment variables in the codespaces created for the repositories that can use them, see Managing development environment secrets. They are managed independently of the Organization Secrets of GitHub Actions: a Codespaces secret and an Actions secret can have the same name and different values.

The value should reference a credential provider instead of being written in clear text, see SecretValue.

Jsonnet Function

orgs.newOrgCodespacesSecret('<name>') {
  <key>: <value>
}

Validation rules

  • a name that is not uppercase triggers an error, as GitHub normalizes secret names to uppercase
  • redacted secret values (********) trigger a validation info and will skip the secret during processing
  • specifying a non-empty list of selected_repositories while visibility is not set to selected triggers a warning

Example usage

orgs.newOrg('OtterdogTest') {
  ...
  codespaces_secrets+: [
    orgs.newOrgCodespacesSecret('REGISTRY_TOKEN') {
      selected_repositories+: [
        "test-repo"
      ],
      value: "pass:path/to/my/secret/value",
      visibility: "selected",
    },
  ],
  ...
}