LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

gh-variable

Manage GitHub Actions configuration variables

TLDR

List variables
$ gh variable list
copy
Set a variable
$ gh variable set [name] -b "[value]"
copy
Set from file
$ gh variable set [name] < [file]
copy
Delete a variable
$ gh variable delete [name]
copy
Get a variable value
$ gh variable get [name]
copy
Set organization variable
$ gh variable set [name] -o [org] -b "[value]"
copy
Set environment variable
$ gh variable set [name] -e [environment] -b "[value]"
copy
List variables as JSON
$ gh variable list --json name,value
copy

SYNOPSIS

gh variable command [options]

DESCRIPTION

gh variable manages GitHub Actions configuration variables for storing non-sensitive workflow data. Unlike secrets, variables are not encrypted and their values can be retrieved, making them suitable for configuration settings, feature flags, and environment names.Variables can be scoped to repositories, organizations, or specific deployment environments. They are accessible in workflows via the vars context (e.g., `vars.VARIABLE_NAME`). They are ideal for API endpoints, build configurations, and other non-secret parameters.

PARAMETERS

-b, --body value

Variable value.
-R, --repo owner/repo
Select a repository.
-o, --org name
Set or list variables for an organization.
-e, --env name
Set or list variables for an environment.
-v, --visibility scope
Set visibility for an organization variable: all, private, or selected.
--json fields
Output JSON with the specified fields.
-q, --jq expression
Filter JSON output using a jq expression.

SUBCOMMANDS

list

List variables.
set
Set a variable.
delete
Delete a variable.
get
Get a single variable.

SEE ALSO

gh(1), gh-secret(1)

Copied to clipboard
Kai