Reference

apex environment

Environments: the protection rules a workflow can only name

apex environment [command]

Examples

The environments a repository protects, and how.

apex environment list acme/web

Require a named reviewer, and deploy only from main.

apex environment set acme/web production --reviewer user:octocat --branch-pattern main

Subcommands

apex environment list

Environments this repository protects, and how

apex environment list [options] <repository>

With an API token, needs the permission environments:read.

Arguments
ArgumentDescription
<repository>owner/repo
Options
OptionDescription
--jsonmachine-readable output

apex environment set

Create or update an environment protection rule (repository admin)

apex environment set [options] <repository> <name>

With an API token, needs the permission environments:write.

Arguments
ArgumentDescription
<repository>owner/repo
<name>environment name, as the workflow spells it
Options
OptionDescription
--wait-timer <minutes>delay before the job may start; 0 removes it
--reviewer <who...>user:<login>, role:<owner|account_admin|billing|member|viewer>, or a bare login (a user)
--branch-pattern <glob...>refs permitted to deploy here (main, releases/*, v?.0)
--prevent-self-reviewrefuse an approval from whoever triggered the run
--allow-self-reviewpermit it (the default)

apex environment delete

Remove an environment protection rule (repository admin)

apex environment delete <repository> <name>

With an API token, needs the permission environments:write.

Arguments
ArgumentDescription
<repository>owner/repo
<name>environment name