Skip to content

Commit ad5c362

Browse files
authored
Actions: env context cannot be used in job.<job_id>.if (#1803)
1 parent a265add commit ad5c362

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

content/actions/reference/context-and-expression-syntax-for-github-actions.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,15 +111,14 @@ The `github` context contains information about the workflow run and the event t
111111

112112
The `env` context contains environment variables that have been set in a workflow, job, or step. For more information about setting environment variables in your workflow, see "[Workflow syntax for {% data variables.product.prodname_actions %}](/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#env)."
113113

114-
The `env` context syntax allows you to use the value of an environment variable in your workflow file. If you want to use the value of an environment variable inside a runner, use the runner operating system's normal method for reading environment variables.
114+
The `env` context syntax allows you to use the value of an environment variable in your workflow file. You can use the `env` context in the value of any key in a **step** except for the `id` and `uses` keys. For more information on the step syntax, see "[Workflow syntax for {% data variables.product.prodname_actions %}](/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_idsteps)."
115115

116-
You can only use the `env` context in the value of the `with` and `name` keys, or in a step's `if` conditional. For more information on the step syntax, see "[Workflow syntax for {% data variables.product.prodname_actions %}](/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_idsteps)."
116+
If you want to use the value of an environment variable inside a runner, use the runner operating system's normal method for reading environment variables.
117117

118118
| Property name | Type | Description |
119119
|---------------|------|-------------|
120120
| `env` | `object` | This context changes for each step in a job. You can access this context from any step in a job. |
121-
| `env.<env name>` | `string` | The value of a specific environment variable. |
122-
121+
| `env.<env_name>` | `string` | The value of a specific environment variable. |
123122

124123
#### `job` context
125124

content/actions/reference/workflow-syntax-for-github-actions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ For more information about cron syntax, see "[Events that trigger workflows](/ac
187187

188188
### `env`
189189

190-
A `map` of environment variables that are available to all jobs and steps in the workflow. You can also set environment variables that are only available to a job or step. For more information, see [`jobs.<job_id>.env`](#jobsjob_idenv) and [`jobs.<job_id>.steps[*].env`](#jobsjob_idstepsenv).
190+
A `map` of environment variables that are available to the steps of all jobs in the workflow. You can also set environment variables that are only available to the steps of a single job or to a single step. For more information, see [`jobs.<job_id>.env`](#jobsjob_idenv) and [`jobs.<job_id>.steps[*].env`](#jobsjob_idstepsenv).
191191

192192
{% data reusables.repositories.actions-env-var-note %}
193193

0 commit comments

Comments
 (0)