Skip to Content
Octopus Energy Packages

GitHub environments

How oe.env resolves GitHub repository and environment scopes

When a --github target does not include an explicit GitHub environment name, oe.env can resolve one from the varlock source environment. If no configured GitHub environment exists, the target remains repository scoped.

Resolution order

Each GitHub target resolves its destination scope independently. The GitHub environment is resolved from:

  1. The explicit GitHub environment in --github=<github-env>:<env>
  2. OE_ENV_GITHUB_ENVIRONMENT for that source environment
  3. No environment, which means repository scoped GitHub Actions secrets and variables

Use --github=<github-env>:<env> to bypass automatic GitHub environment resolution for that target.

pnpm oe.env sync --github=Preview:preview

Repository scoped syncs

A bare GitHub target syncs one varlock source environment to the current GitHub repository:

pnpm oe.env sync --github

This is equivalent to --github=preview. If OE_ENV_GITHUB_ENVIRONMENT is not set for preview, the command writes repository secrets and repository variables. If OE_ENV_GITHUB_ENVIRONMENT=Preview is set for preview, the same command writes environment secrets and environment variables for the Preview GitHub environment.

Multiple GitHub targets

Multiple GitHub targets are allowed when their resolved destination scopes are distinct:

pnpm oe.env sync --github=preview --github=production

This works when, for example, preview resolves to Preview and production resolves to Production through OE_ENV_GITHUB_ENVIRONMENT.

The command fails if two targets resolve to the same GitHub scope. GitHub environment names are compared case insensitively, matching GitHub's uniqueness rules. Repository scope remains distinct from a GitHub environment named repository.

This prevents one source environment from overwriting another source environment in the same repository or GitHub environment.

On this page