Cannot use inputs in non-composite actions
See original GitHub issueDescribe the bug No matter what I try, I cannot get inputs to work with non-composite actions. I’m allowed to define them, and trigger an action via API whilst providing inputs, but they cannot be referenced and don’t show up as env vars later in the action (non-composite). I suspect the answer here is “you can’t do that”, however:
- I should be able to, why no? It’d be helpful
- The docs don’t say that, and even if you disagree with the former point, you should support accurate docs.
To Reproduce create an action looking roughly like this:
name: test_workflow
on:
workflow_dispatch:
inputs:
varname:
required: true
description: 'a test varname'
jobs:
test:
name: test
runs-on: ubuntu-20.04
steps:
# Checks-out repository under $GITHUB_WORKSPACE
- name: Checkout commit
uses: actions/checkout@v2
with:
fetch-depth: 1
# Print inputs
- name: Print inputs
run: echo ${{ inputs.varname }}
i also tried just using INPUTS_VARNAME
, dumping env
, etc. nothing worked. Either got Unrecognized named-value: 'inputs'
as an error, the variable resolved to nothing, and when I dumped env
there were no inputs present.
Expected behavior Either inputs should work (ideal), or the docs should explicitly say “this only works with composite actions”.
What’s not working?
Either got Unrecognized named-value: 'inputs'
as an error, the variable resolved to nothing, and when I dumped env
there were no inputs present.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:5
- Comments:7 (1 by maintainers)
Top GitHub Comments
I know this is old, but this continues to be a footgun, and the new docs (https://docs.github.com/en/actions/using-workflows/reusing-workflows#using-inputs-and-secrets-in-a-reusable-workflow) are not convoluted to interpret. They explicitly claim and use as an example that
${{ inputs.name }}
should work.with the demo code:
The docs are a bit convoluted to interpret, but the issue you are having is you aren’t using the github context (documented here in the context section of the expression syntax guide). Combining that with the docs for the workflow dispatch event you can rewrite:
as the following to access inputs in your example yaml file: