-
Notifications
You must be signed in to change notification settings - Fork 979
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
INPUT_* environment variables are missing in composite actions #665
Comments
When authoring a composite action, inputs must be mapped into inner steps using GitHub Actions expressions. For example, map into the script directly: inputs:
foo:
description: 'Test input'
required: yes
runs:
using: composite
steps:
- run: |
echo "FOO: ${{inputs.foo}}"
shell: bash Or for example, map into the script indirectly via env var: inputs:
foo:
description: 'Test input'
required: yes
runs:
using: composite
steps:
- run: |
echo "FOO: $MY_VAR"
shell: bash
env:
MY_VAR: ${{ inputs.foo }} |
We need to update the referenced doc |
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 |
I've hit that as well. After some thought I imagine it's because if, in future, they enable composite steps to contain other Better documentation definitely will help there. :) edit I think it's also important to include the |
👋 I've been using a workaround like _ericsciple's:
I want to map the variable as I'd dig a way to say "please forward ALL my (I wound up here after adding an input and forgetting about needing this hack to forward it. ~10% of my current action.yaml is input forwarding boilerplate) |
Correct input env vars see actions/runner/issues/665
They don't work in composite actions, and this is not documented because why not? See actions/runner#665
As per the documentation, we were using INPUT_* variables to pass the action input parameters to the scripts that expected them. But there seems to be either a mistake in the documentation, or a bug in the runners, as can be found here: actions/runner#665
Adds information regarding the INPUT_ environment variable conversion as discussed at actions/runner#665.
The documentation here should also reflect the special behavior mentioned at the top of the page. Probably more importantly in the section more explicitly dedicated to |
The issue still exists but thanks to the above workaround, which works. Wondering any updates or plans on this? |
I seem to have stumbled on another corner case in an action. The inputs.xyz seem to disappear after a step that uses a ci.yaml. (steps: uses action1 passing inputs in with:) Work around by adding all to env. |
Note that Github recommends to not use |
Referencing this: actions/runner#665 (comment) as a workaround to get inputs into bash scripts in composite actions.
there's an issue with this, is that we can't use @actions/core's getInput because it relies on For people interested in fixing the above, an easy fix is to manually provide the env var such as: env:
INPUT_FOO: ${{ inputs.foo }} it's not ideal, but i'll fix the glue with what's expected from |
this is a known thing with composite: - actions/runner#665 (comment)
According to the documentation actions should receive their input values as environment variables prefixed with
INPUT_
in addition to theinputs
context. These environment variables are missing for composite actions.To Reproduce
Steps to reproduce the behavior:
INPUT
variables: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?
OS of the machine running the runner? OSX/Windows/Linux/...
Job Log Output
From the workflow run linked above:
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.
The text was updated successfully, but these errors were encountered: