The easiest way to use dotEnv Cloud in GitHub Actions is the official dotEnv Secrets action, dotenvcloud/action-github. It installs the CLI, authenticates with your API key, and pulls your secrets in a single step, no manual install required. If you'd rather drive the CLI yourself, a manual approach is documented at the end.
Create an organization API key
CI/CD should authenticate with an organization API key, not OAuth. API keys are scoped to a single organization and require no browser. Create one in the dotEnv Cloud dashboard, then add it to your repository under Settings → Secrets and variables → Actions as DOTENV_API_KEY.
secrets so it stays encrypted at rest in GitHub.
Quick start with the dotEnv action
Add the action to your workflow and point it at a project and target. It writes the merged secrets to a .env file (configurable via output-file):
Narrow the pull to a single environment within a target by adding environment (for example api or web):
Expose secrets to later steps
Set export-variables: true to load the pulled secrets into the GitHub job environment, so subsequent steps can read them as plain environment variables (values are masked in logs). This requires the default format: env:
Inputs
The most common inputs (see the action's README for the full list):
api-key: organization API key. Required.project: project to pull from. Required.target: target within the project (e.g.production).environment: environment within the target (e.g.api).output-file: path to write (default.env).format:env,json,yaml,shell, ordockerfile(defaultenv).export-variables: load secrets into$GITHUB_ENV(defaultfalse).merge: merge secrets across hierarchy levels (defaulttrue).resolve: resolve variable interpolation (defaultfalse).organization: organization to use, if not the token's default.cli-version: pin a specific CLI version (defaultlatest).
The action exposes one output, env-file, with the path to the generated file.
Client-managed encryption
If the project uses client-managed encryption, the CLI needs the key to decrypt. Store the key as a separate GitHub secret and expose it as DOTENV_CLIENT_KEY at the job (or step) level, and the action's CLI run inherits it:
Without the action (manual CLI install)
If you can't use the action (a self-hosted runner with locked-down network egress, or you need full control over the CLI invocation), install the binary and call dotenv pull yourself:
For more hardening tips, read Securing CI/CD Pipelines.