1
0
mirror of synced 2025-12-22 03:16:52 -05:00

Clarify how INPUT_<VARIABLE_NAME> works or doesn't

See actions/runner#665
This commit is contained in:
Josh Soref
2021-06-27 22:50:07 -04:00
committed by Josh Soref
parent b2724f0c2c
commit cd5599e345

View File

@@ -56,7 +56,13 @@ inputs:
required: true
```
When you specify an input to an action in a workflow file or use a default input value, {% 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. 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 "[Creating a Docker container action](/articles/creating-a-docker-container-action#creating-an-action-metadata-file)."
When you specify an input in a workflow file or use a default input value, {% data variables.product.prodname_dotcom %} *sometimes* creates an environment variable for the input with the name `INPUT_<VARIABLE_NAME>`.
**Often it doesn't.**
The environment variable created converts input names to uppercase letters and replaces spaces with `_` characters.
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 "[Creating a Docker container action](/articles/creating-a-docker-container-action#creating-an-action-metadata-file)."
If the action is written using a [composite](/actions/creating-actions/creating-a-composite-run-steps-action), then it will not automatically get `INPUT_<VARIABLE_NAME>`. Instead, it is incumbent on the author of the action to manually reimplement this behavior themselves.
For example, if a workflow defined the `numOctocats` and `octocatEyeColor` inputs, the action code could read the values of the inputs using the `INPUT_NUMOCTOCATS` and `INPUT_OCTOCATEYECOLOR` environment variables.