Skip to content

Commit 4717018

Browse files
jc-clarkgithub-actionstauhid621lucascosti
authored
Add documentation for GitHub Actions configuration variables (#33119)
Co-authored-by: github-actions <[email protected]> Co-authored-by: Tauhid Anjum <[email protected]> Co-authored-by: Lucas Costi <[email protected]>
1 parent d27720c commit 4717018

File tree

49 files changed

+561
-352
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+561
-352
lines changed
Loading
Loading
Loading
Loading

content/actions/creating-actions/dockerfile-support-for-github-actions.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Some Docker instructions interact with GitHub Actions, and an action's metadata
2525

2626
### USER
2727

28-
Docker actions must be run by the default Docker user (root). Do not use the `USER` instruction in your `Dockerfile`, because you won't be able to access the `GITHUB_WORKSPACE`. For more information, see "[Using environment variables](/actions/configuring-and-managing-workflows/using-environment-variables)" and [USER reference](https://docs.docker.com/engine/reference/builder/#user) in the Docker documentation.
28+
Docker actions must be run by the default Docker user (root). Do not use the `USER` instruction in your `Dockerfile`, because you won't be able to access the `GITHUB_WORKSPACE`. For more information, see "[Variables](/actions/learn-github-actions/variables#default-environment-variables)" and [USER reference](https://docs.docker.com/engine/reference/builder/#user) in the Docker documentation.
2929

3030
### FROM
3131

@@ -39,7 +39,7 @@ These are some best practices when setting the `FROM` argument:
3939

4040
### WORKDIR
4141

42-
{% data variables.product.product_name %} sets the working directory path in the `GITHUB_WORKSPACE` environment variable. It's recommended to not use the `WORKDIR` instruction in your `Dockerfile`. Before the action executes, {% data variables.product.product_name %} will mount the `GITHUB_WORKSPACE` directory on top of anything that was at that location in the Docker image and set `GITHUB_WORKSPACE` as the working directory. For more information, see "[Using environment variables](/actions/configuring-and-managing-workflows/using-environment-variables)" and the [WORKDIR reference](https://docs.docker.com/engine/reference/builder/#workdir) in the Docker documentation.
42+
{% data variables.product.product_name %} sets the working directory path in the `GITHUB_WORKSPACE` environment variable. It's recommended to not use the `WORKDIR` instruction in your `Dockerfile`. Before the action executes, {% data variables.product.product_name %} will mount the `GITHUB_WORKSPACE` directory on top of anything that was at that location in the Docker image and set `GITHUB_WORKSPACE` as the working directory. For more information, see "[Variables](/actions/learn-github-actions/variables#default-environment-variables)" and the [WORKDIR reference](https://docs.docker.com/engine/reference/builder/#workdir) in the Docker documentation.
4343

4444
### ENTRYPOINT
4545

content/actions/hosting-your-own-runners/running-scripts-before-or-after-a-job.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ The following scripting languages are supported:
2929

3030
Your custom scripts can use the following features:
3131

32-
- **Environment variables**: Scripts have access to the default environment variables. The full webhook event payload can be found in `GITHUB_EVENT_PATH`. For more information, see "[Environment variables](/actions/learn-github-actions/environment-variables#default-environment-variables)."
32+
- **Variables**: Scripts have access to the default variables. The full webhook event payload can be found in `GITHUB_EVENT_PATH`. For more information, see "[Variables](/actions/learn-github-actions/variables#default-environment-variables)."
3333
- **Workflow commands**: Scripts can use workflow commands. For more information, see ["Workflow commands for {% data variables.product.prodname_actions %}"](/actions/using-workflows/workflow-commands-for-github-actions){% ifversion actions-save-state-set-output-envs %}{% else %}, with the exception of `save-state` and `set-output`, which are not supported by these scripts{% endif %}. Scripts can also use environment files. For more information, see [Environment files](/actions/using-workflows/workflow-commands-for-github-actions#environment-files).
3434

3535
{% note %}

content/actions/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ featuredLinks:
2424
- /actions/learn-github-actions/events-that-trigger-workflows
2525
- /actions/learn-github-actions/contexts
2626
- /actions/learn-github-actions/expressions
27-
- /actions/learn-github-actions/environment-variables
27+
- /actions/learn-github-actions/variables
2828
- /actions/security-guides/encrypted-secrets
2929
changelog:
3030
label: actions

content/actions/learn-github-actions/contexts.md

Lines changed: 82 additions & 54 deletions
Large diffs are not rendered by default.

content/actions/learn-github-actions/environment-variables.md

Lines changed: 0 additions & 211 deletions
This file was deleted.

content/actions/learn-github-actions/essential-features-of-github-actions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
POSTGRES_PORT: 5432
3535
```
3636
37-
For more information, see "[Using environment variables](/actions/configuring-and-managing-workflows/using-environment-variables)."
37+
For more information, see "[Variables](/actions/learn-github-actions/variables#default-environment-variables)."
3838
3939
## Adding scripts to your workflow
4040

content/actions/learn-github-actions/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ children:
2424
- /essential-features-of-github-actions
2525
- /expressions
2626
- /contexts
27-
- /environment-variables
27+
- /variables
2828
- /usage-limits-billing-and-administration
2929
---
3030

content/actions/learn-github-actions/variables.md

Lines changed: 317 additions & 0 deletions
Large diffs are not rendered by default.

content/actions/migrating-to-github-actions/migrating-from-circleci-to-github-actions.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,9 @@ For more information about the tools and packages available on {% data variables
7373

7474
## Using variables and secrets
7575

76-
CircleCI and {% data variables.product.prodname_actions %} support setting environment variables in the configuration file and creating secrets using the CircleCI or {% data variables.product.product_name %} UI.
76+
CircleCI and {% data variables.product.prodname_actions %} support setting variables in the configuration file and creating secrets using the CircleCI or {% data variables.product.product_name %} UI.
7777

78-
For more information, see "[Using environment variables](/actions/configuring-and-managing-workflows/using-environment-variables)" and "[Creating and using encrypted secrets](/actions/configuring-and-managing-workflows/creating-and-storing-encrypted-secrets)."
78+
For more information, see "[Variables](/actions/learn-github-actions/variables#default-environment-variables)" and "[Creating and using encrypted secrets](/actions/configuring-and-managing-workflows/creating-and-storing-encrypted-secrets)."
7979

8080
## Caching
8181

content/actions/migrating-to-github-actions/migrating-from-gitlab-cicd-to-github-actions.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,9 +301,9 @@ For more information, see "[Events that trigger workflows](/actions/reference/ev
301301

302302
## Variables and secrets
303303

304-
GitLab CI/CD and {% data variables.product.prodname_actions %} support setting environment variables in the pipeline or workflow configuration file, and creating secrets using the GitLab or {% data variables.product.product_name %} UI.
304+
GitLab CI/CD and {% data variables.product.prodname_actions %} support setting variables in the pipeline or workflow configuration file, and creating secrets using the GitLab or {% data variables.product.product_name %} UI.
305305

306-
For more information, see "[Environment variables](/actions/reference/environment-variables)" and "[Encrypted secrets](/actions/reference/encrypted-secrets)."
306+
For more information, see "[Variables](/actions/learn-github-actions/variables)" and "[Encrypted secrets](/actions/reference/encrypted-secrets)."
307307

308308
## Caching
309309

content/actions/migrating-to-github-actions/migrating-from-travis-ci-to-github-actions.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,13 @@ To give you control over when CI tasks are executed, a {% data variables.product
4343

4444
Travis CI and {% data variables.product.prodname_actions %} both use YAML to create jobs and workflows, and these files are stored in the code's repository. For more information on how {% data variables.product.prodname_actions %} uses YAML, see ["Creating a workflow file](/actions/learn-github-actions/introduction-to-github-actions#create-an-example-workflow)."
4545

46-
### Custom environment variables
46+
### Custom variables
4747

48-
Travis CI lets you set environment variables and share them between stages. Similarly, {% data variables.product.prodname_actions %} lets you define environment variables for a step, job, or workflow. For more information, see ["Environment variables](/actions/reference/environment-variables)."
48+
Travis CI lets you set variables and share them between stages. Similarly, {% data variables.product.prodname_actions %} lets you define variables for a workflows. For more information, see "[Variables](/actions/learn-github-actions/variables)."
4949

50-
### Default environment variables
50+
### Default variables
5151

52-
Travis CI and {% data variables.product.prodname_actions %} both include default environment variables that you can use in your YAML files. For {% data variables.product.prodname_actions %}, you can see these listed in "[Default environment variables](/actions/reference/environment-variables#default-environment-variables)."
52+
Travis CI and {% data variables.product.prodname_actions %} both include default environment variables that you can use in your YAML files. For {% data variables.product.prodname_actions %}, you can see these listed in "[Default environment variables](/actions/learn-github-actions/variables#default-environment-variables)."
5353

5454
### Parallel job processing
5555

@@ -178,7 +178,7 @@ git:
178178
179179
### Using environment variables in a matrix
180180
181-
Travis CI and {% data variables.product.prodname_actions %} can both add custom environment variables to a test matrix, which allows you to refer to the variable in a later step.
181+
Travis CI and {% data variables.product.prodname_actions %} can both add custom variables to a test matrix, which allows you to refer to the variable in a later step.
182182
183183
In {% data variables.product.prodname_actions %}, you can use the `include` key to add custom environment variables to a matrix. {% data reusables.actions.matrix-variable-example %}
184184

content/actions/monitoring-and-troubleshooting-workflows/enabling-debug-logging.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ versions:
1616

1717
These extra logs are enabled by setting secrets in the repository containing the workflow, so the same permissions requirements will apply:
1818

19-
- {% data reusables.actions.permissions-statement-secrets-repository %}
19+
- {% data reusables.actions.permissions-statement-secrets-variables-repository %}
2020
- {% data reusables.actions.permissions-statement-secrets-environment %}
21-
- {% data reusables.actions.permissions-statement-secrets-organization %}
21+
- {% data reusables.actions.permissions-statement-secrets-and-variables-organization %}
2222
- {% data reusables.actions.permissions-statement-secrets-api %}
2323

2424
For more information on setting secrets, see "[Creating and using encrypted secrets](/actions/automating-your-workflow-with-github-actions/creating-and-using-encrypted-secrets)."

content/actions/publishing-packages/publishing-java-packages-with-gradle.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ For more information about creating a CI workflow for your Java project with Gra
3434
You may also find it helpful to have a basic understanding of the following:
3535

3636
- "[Working with the npm registry](/packages/working-with-a-github-packages-registry/working-with-the-npm-registry)"
37-
- "[Environment variables](/actions/reference/environment-variables)"
37+
- "[Variables](/actions/learn-github-actions/variables)"
3838
- "[Encrypted secrets](/actions/reference/encrypted-secrets)"
3939
- "[Authentication in a workflow](/actions/reference/authentication-in-a-workflow)"
4040

@@ -160,10 +160,10 @@ on:
160160
types: [created]
161161
jobs:
162162
publish:
163-
runs-on: ubuntu-latest
164-
permissions:
163+
runs-on: ubuntu-latest
164+
permissions:
165165
contents: read
166-
packages: write
166+
packages: write
167167
steps:
168168
- uses: {% data reusables.actions.action-checkout %}
169169
- uses: {% data reusables.actions.action-setup-java %}
@@ -241,10 +241,10 @@ on:
241241
types: [created]
242242
jobs:
243243
publish:
244-
runs-on: ubuntu-latest
245-
permissions:
244+
runs-on: ubuntu-latest
245+
permissions:
246246
contents: read
247-
packages: write
247+
packages: write
248248
steps:
249249
- uses: {% data reusables.actions.action-checkout %}
250250
- name: Set up Java

content/actions/publishing-packages/publishing-java-packages-with-maven.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ For more information about creating a CI workflow for your Java project with Mav
3434
You may also find it helpful to have a basic understanding of the following:
3535

3636
- "[Working with the npm registry](/packages/working-with-a-github-packages-registry/working-with-the-npm-registry)"
37-
- "[Environment variables](/actions/reference/environment-variables)"
37+
- "[Variables](/actions/learn-github-actions/variables)"
3838
- "[Encrypted secrets](/actions/reference/encrypted-secrets)"
3939
- "[Authentication in a workflow](/actions/reference/authentication-in-a-workflow)"
4040

@@ -142,10 +142,10 @@ on:
142142
types: [created]
143143
jobs:
144144
publish:
145-
runs-on: ubuntu-latest
146-
permissions:
145+
runs-on: ubuntu-latest
146+
permissions:
147147
contents: read
148-
packages: write
148+
packages: write
149149
steps:
150150
- uses: {% data reusables.actions.action-checkout %}
151151
- uses: {% data reusables.actions.action-setup-java %}
@@ -179,10 +179,10 @@ on:
179179
types: [created]
180180
jobs:
181181
publish:
182-
runs-on: ubuntu-latest
183-
permissions:
182+
runs-on: ubuntu-latest
183+
permissions:
184184
contents: read
185-
packages: write
185+
packages: write
186186
steps:
187187
- uses: {% data reusables.actions.action-checkout %}
188188
- name: Set up Java for publishing to Maven Central Repository

content/actions/publishing-packages/publishing-nodejs-packages.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ For more information about creating a CI workflow for your Node.js project, see
3535
You may also find it helpful to have a basic understanding of the following:
3636

3737
- "[Working with the npm registry](/packages/working-with-a-github-packages-registry/working-with-the-npm-registry)"
38-
- "[Environment variables](/actions/reference/environment-variables)"
38+
- "[Variables](/actions/learn-github-actions/variables)"
3939
- "[Encrypted secrets](/actions/reference/encrypted-secrets)"
4040
- "[Authentication in a workflow](/actions/reference/authentication-in-a-workflow)"
4141

@@ -128,10 +128,10 @@ on:
128128
types: [created]
129129
jobs:
130130
build:
131-
runs-on: ubuntu-latest
132-
permissions:
131+
runs-on: ubuntu-latest
132+
permissions:
133133
contents: read
134-
packages: write
134+
packages: write
135135
steps:
136136
- uses: {% data reusables.actions.action-checkout %}
137137
# Setup .npmrc file to publish to GitHub Packages

content/actions/security-guides/encrypted-secrets.md

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ redirect_from:
88
- /actions/configuring-and-managing-workflows/using-variables-and-secrets-in-a-workflow
99
- /actions/reference/encrypted-secrets
1010
- /actions/managing-workflows/storing-secrets
11-
11+
1212
miniTocMaxHeadingLevel: 3
1313
versions:
1414
fpt: '*'
@@ -22,7 +22,7 @@ versions:
2222

2323
## About encrypted secrets
2424

25-
Secrets are encrypted environment variables that you create in an organization, repository, or repository environment. The secrets that you create are available to use in {% data variables.product.prodname_actions %} workflows. {% data variables.product.prodname_dotcom %} uses a [libsodium sealed box](https://libsodium.gitbook.io/doc/public-key_cryptography/sealed_boxes) to help ensure that secrets are encrypted before they reach {% data variables.product.prodname_dotcom %} and remain encrypted until you use them in a workflow.
25+
Secrets are encrypted variables that you create in an organization, repository, or repository environment. The secrets that you create are available to use in {% data variables.product.prodname_actions %} workflows. {% data variables.product.prodname_dotcom %} uses a [libsodium sealed box](https://libsodium.gitbook.io/doc/public-key_cryptography/sealed_boxes) to help ensure that secrets are encrypted before they reach {% data variables.product.prodname_dotcom %} and remain encrypted until you use them in a workflow.
2626

2727
{% data reusables.actions.secrets-org-level-overview %}
2828

@@ -40,7 +40,9 @@ For secrets stored at the environment level, you can enable required reviewers t
4040

4141
### Naming your secrets
4242

43-
{% data reusables.codespaces.secrets-naming %}
43+
The following rules apply to secret names:
44+
45+
{% data reusables.actions.actions-secrets-and-variables-naming %}
4446

4547
For example, a secret created at the environment level must have a unique name in that environment, a secret created at the repository level must have a unique name in that repository, and a secret created at the organization level must have a unique name at that level.
4648

@@ -72,13 +74,16 @@ When generating credentials, we recommend that you grant the minimum permissions
7274

7375
## Creating encrypted secrets for a repository
7476

75-
{% data reusables.actions.permissions-statement-secrets-repository %}
77+
{% data reusables.actions.permissions-statement-secrets-variables-repository %}
7678

7779
{% webui %}
7880

7981
{% data reusables.repositories.navigate-to-repo %}
8082
{% data reusables.repositories.sidebar-settings %}
81-
{% data reusables.actions.sidebar-secret %}
83+
{% data reusables.actions.sidebar-secrets-and-variables %}
84+
{%- ifversion actions-configuration-variables %}
85+
{% data reusables.actions.actions-secrets-tab %}
86+
![Repository secrets tab](/assets/images/help/repository/actions-secrets-tab.png){% endif %}
8287
1. Click **New repository secret**.
8388
1. Type a name for your secret in the **Name** input box.
8489
1. Enter the value for your secret.
@@ -143,15 +148,18 @@ gh secret list --env ENV_NAME
143148

144149
## Creating encrypted secrets for an organization
145150

146-
When creating a secret in an organization, you can use a policy to limit which repositories can access that secret. For example, you can grant access to all repositories, or limit access to only private repositories or a specified list of repositories.
151+
{% data reusables.actions.actions-secrets-variables-repository-access %}
147152

148-
{% data reusables.actions.permissions-statement-secrets-organization %}
153+
{% data reusables.actions.permissions-statement-secrets-and-variables-organization %}
149154

150155
{% webui %}
151156

152157
{% data reusables.organizations.navigate-to-org %}
153158
{% data reusables.organizations.org_settings %}
154-
{% data reusables.actions.sidebar-secret %}
159+
{% data reusables.actions.sidebar-secrets-and-variables %}
160+
{%- ifversion actions-configuration-variables %}
161+
{% data reusables.actions.actions-secrets-tab %}
162+
![Organization secrets tab](/assets/images/help/organizations/actions-organization-secrets-tab.png){% endif %}
155163
1. Click **New organization secret**.
156164
1. Type a name for your secret in the **Name** input box.
157165
1. Enter the **Value** for your secret.
@@ -204,9 +212,9 @@ You can check which access policies are being applied to a secret in your organi
204212
205213
{% data reusables.organizations.navigate-to-org %}
206214
{% data reusables.organizations.org_settings %}
207-
{% data reusables.actions.sidebar-secret %}
215+
{% data reusables.actions.sidebar-secrets-and-variables %}
208216
1. The list of secrets includes any configured permissions and policies. For example:
209-
![Secrets list](/assets/images/help/settings/actions-org-secrets-list.png)
217+
![Secrets list](/assets/images/help/settings/actions-org-secrets-list.png)
210218
1. For more details on the configured permissions for each secret, click **Update**.
211219
212220
## Using encrypted secrets in a workflow
@@ -356,9 +364,9 @@ To use secrets that are larger than 64 KB, you can use a workaround to store enc
356364
357365
```yaml
358366
name: Workflows with large secrets
359-
367+
360368
on: push
361-
369+
362370
jobs:
363371
my-job:
364372
name: My Job
@@ -399,7 +407,7 @@ You can use Base64 encoding to store small binary blobs as secrets. You can then
399407
✓ Set secret CERTIFICATE_BASE64 for octocat/octorepo
400408
```
401409
402-
1. To access the Base64 string from your runner, pipe the secret to `base64 --decode`. For example:
410+
1. To access the Base64 string from your runner, pipe the secret to `base64 --decode`. For example:
403411
404412
```yaml
405413
name: Retrieve Base64 secret

content/actions/using-github-hosted-runners/about-github-hosted-runners.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ The list of {% data variables.product.prodname_actions %} IP addresses returned
194194
| `workspace` | `GITHUB_WORKSPACE` | Actions and shell commands execute in this directory. An action can modify the contents of this directory, which subsequent actions can access. |
195195
| `workflow/event.json` | `GITHUB_EVENT_PATH` | The `POST` payload of the webhook event that triggered the workflow. {% data variables.product.prodname_dotcom %} rewrites this each time an action executes to isolate file content between actions.
196196

197-
For a list of the environment variables {% data variables.product.prodname_dotcom %} creates for each workflow, see "[Using environment variables](/github/automating-your-workflow-with-github-actions/using-environment-variables)."
197+
For a list of the environment variables {% data variables.product.prodname_dotcom %} creates for each workflow, see "[Variables](/actions/learn-github-actions/variables#default-environment-variables)."
198198

199199
### Docker container filesystem
200200

0 commit comments

Comments
 (0)