Skip to content

Commit c6cd6fd

Browse files
committed
Clarify vars and secrets context availability in composite actions
1 parent be38ec5 commit c6cd6fd

3 files changed

Lines changed: 5 additions & 2 deletions

File tree

‎content/actions/reference/workflows-and-actions/contexts.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ jobs:
343343

344344
## `vars` context
345345

346-
The `vars` context contains custom configuration variables set at the organization, repository, and environment levels. For more information about defining configuration variables for use in multiple workflows, see [AUTOTITLE](/actions/how-tos/write-workflows/choose-what-workflows-do/use-variables#defining-configuration-variables-for-multiple-workflows).
346+
The `vars` context contains custom configuration variables set at the organization, repository, and environment levels. The `vars` context is not available for composite actions. If you want to pass a configuration variable to a composite action, you need to do it explicitly as an input. For more information about configuration variables, see [AUTOTITLE](/actions/how-tos/write-workflows/choose-what-workflows-do/use-variables#defining-configuration-variables-for-multiple-workflows).
347347

348348
### Example contents of the `vars` context
349349

‎content/actions/reference/workflows-and-actions/metadata-syntax.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ inputs:
6161
6262
When you specify an input, {% data variables.product.prodname_dotcom %} creates an environment variable for the input with the name `INPUT_<VARIABLE_NAME>`. The environment variable created converts input names to uppercase letters and replaces spaces with `_` characters.
6363

64-
If the action is written using a [composite](/actions/tutorials/create-actions/create-a-composite-action), then it will not automatically get `INPUT_<VARIABLE_NAME>`. With composite actions you can use the [`inputs` context](/actions/reference/workflows-and-actions/contexts#inputs-context) to access action inputs.
64+
If the action is written using a [composite](/actions/tutorials/create-actions/create-a-composite-action), then it will not automatically get `INPUT_<VARIABLE_NAME>`. With composite actions you can use the [`inputs` context](/actions/reference/workflows-and-actions/contexts#inputs-context) to access action inputs. The `secrets` and `vars` contexts are not directly available inside composite actions; any secrets or configuration variables must be passed explicitly as inputs from the calling workflow.
6565

6666
To access the environment variable in a Docker container action, you must pass the input using the `args` keyword in the action metadata file. For more information about the action metadata file for Docker container actions, see [AUTOTITLE](/actions/tutorials/use-containerized-services/create-a-docker-container-action#creating-an-action-metadata-file).
6767

‎content/actions/tutorials/create-actions/create-a-composite-action.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ Once you complete this project, you should understand how to build your own comp
3131

3232
Composite actions allow you to collect a series of workflow job steps into a single action which you can then run as a single job step in multiple workflows. Reusable workflows provide another way of avoiding duplication, by allowing you to run a complete workflow from within other workflows. For more information, see [AUTOTITLE](/actions/concepts/workflows-and-actions/reusing-workflow-configurations).
3333

34+
> [!NOTE]
35+
> Composite actions do not have direct access to the `secrets` or `vars` contexts. If your composite action requires secrets or configuration variables, pass them explicitly using `inputs`. For more information, see [AUTOTITLE](/actions/reference/workflows-and-actions/contexts#secrets-context) and [AUTOTITLE](/actions/reference/workflows-and-actions/contexts#vars-context).
36+
3437
## Prerequisites
3538
>
3639
> [!NOTE]

0 commit comments

Comments
 (0)