1GH-VARIABLE-SET(1)             GitHub CLI manual            GH-VARIABLE-SET(1)
2
3
4

NAME

6       gh-variable-set - Create or update variables
7
8
9

SYNOPSIS

11       gh variable set <variable-name> [flags]
12
13
14

DESCRIPTION

16       Set a value for a variable on one of the following levels: - repository
17       (default): available to Actions runs or Dependabot in  a  repository  -
18       environment:  available to Actions runs for a deployment environment in
19       a repository - organization: available to Actions  runs  or  Dependabot
20       within an organization
21
22
23       Organization variable can optionally be restricted to only be available
24       to specific repositories.
25
26
27

OPTIONS

29       -b, --body <string>
30              The value for the variable (reads from  standard  input  if  not
31              specified)
32
33
34       -e, --env <environment>
35              Set deployment environment variable
36
37
38       -f, --env-file <file>
39              Load variable names and values from a dotenv-formatted file
40
41
42       -o, --org <organization>
43              Set organization variable
44
45
46       -r, --repos <repositories>
47              List of repositories that can access an organization variable
48
49
50       -v, --visibility <string>
51              Set  visibility  for  an organization variable: {all|private|se‐
52              lected}
53
54
55

OPTIONS INHERITED FROM PARENT COMMANDS

57       -R, --repo <[HOST/]OWNER/REPO>
58              Select another repository using the [HOST/]OWNER/REPO format
59
60
61

EXAMPLE

63       # Add variable value for the current repository in an interactive prompt
64       $ gh variable set MYVARIABLE
65
66       # Read variable value from an environment variable
67       $ gh variable set MYVARIABLE --body "$ENV_VALUE"
68
69       # Read variable value from a file
70       $ gh variable set MYVARIABLE < myfile.txt
71
72       # Set variable for a deployment environment in the current repository
73       $ gh variable set MYVARIABLE --env myenvironment
74
75       # Set organization-level variable visible to both public and private repositories
76       $ gh variable set MYVARIABLE --org myOrg --visibility all
77
78       # Set organization-level variable visible to specific repositories
79       $ gh variable set MYVARIABLE --org myOrg --repos repo1,repo2,repo3
80
81       # Set multiple variables imported from the ".env" file
82       $ gh variable set -f .env
83
84
85
86
87

SEE ALSO

89       gh-variable(1)
90
91
92
93                                   Nov 2023                 GH-VARIABLE-SET(1)
Impressum