INPUT_* environment variables are missing in composite actions
See original GitHub issueAccording to the documentation actions should receive their input values as environment variables prefixed with INPUT_
in addition to the inputs
context. These environment variables are missing for composite actions.
To Reproduce Steps to reproduce the behavior:
- Create a composite action with one or more inputs, and a step that outputs the associated
INPUT
variables:
inputs:
foo:
description: 'Test input'
required: yes
runs:
using: composite
steps:
- run: |
echo "FOO: ${INPUT_FOO}"
shell: bash
- Use the action in a workflow:
steps:
- uses: ./example-action
with:
foo: 'bar'
- Observe the lack of value after the
FOO:
prefix.
I have an example action and workflow (the uses: ./composite-action
step) that demonstrate the issue and the obvious workaround. There’s a workflow run as well (check the “Run /./composite-action” step).
Expected behavior
Steps should be able to read inputs via environment variables, INPUT_FOO
in the example above, INPUT_NUM1
(to 4) in my reproducer.
Runner Version and Platform
Version of your runner?
- 2.272.0
OS of the machine running the runner? OSX/Windows/Linux/…
- Ubuntu 20.04.1 LTS (Github hosted runner VM)
Job Log Output
From the workflow run linked above:
Run ./composite-action
with:
num1: 1
num2: 4
num3: 0
num4: 0
Show INPUT vars
INPUT_NUM1 =
INPUT_NUM2 =
INPUT_NUM3 =
INPUT_NUM4 =
Add numbers
Credit
I became aware of the issue thanks to a post on the Github community forum and tried to reproduce the issue out of curiosity.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:50
- Comments:15 (2 by maintainers)
Top GitHub Comments
When authoring a composite action, inputs must be mapped into inner steps using GitHub Actions expressions.
For example, map into the script directly:
Or for example, map into the script indirectly via env var:
Fair enough, but wouldn’t it be simpler to have the same behavior across all kinds of actions? Or is there a technical reason not to provide the
INPUT_
environment variables?