Inputs context not available in reusable workflows
See original GitHub issueDescribe the bug
The inputs context does not seem available in the with
context of reusable workflows
To Reproduce
- Create a reusable workflow that has the following input
stg_image_build:
description: whether to build the staging image
required: true
type: boolean
default: false
Invoke it as follows
workflow_dispatch:
inputs:
push_to_stg:
description: "Build and push image to staging registry"
type: boolean
default: false
required: true
...
build-and-push-image:
needs:
- echo-input
uses: Org/repo/.github/workflows/myreusableworkflow.yaml@master
with:
stg_image_build: ${{ inputs.push_to_stg }}
Fails
The template is not valid. .github/workflows/calling.yaml (Line: 15, Col: 24): Unexpected type of value '', expected type: Boolean.
Expected behavior
The stg_image_build: ${{ inputs.push_to_stg }}
line should be passing to the reusable workflow a boolean.
Runner Version and Platform
GitHub hosted runner
OS of the machine running the runner? OSX/Windows/Linux/…
ubuntu-latest
What’s not working?
The template is not valid. .github/workflows/calling.yaml (Line: 15, Col: 24): Unexpected type of value '', expected type: Boolean.
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:7 (1 by maintainers)
Top Results From Across the Web
Reusing workflows
To reuse variables in multiple workflows, set them at the organization, repository, or environment levels and reference them using the vars context. For...
Read more >Why is env context not available in Github action job level if ...
The documentation reads. You can access this context from any step in a job. This object contains the properties listed below. ~ env...
Read more >Inputs unified across manual and reusable workflows
For workflows triggered by workflow_dispatch inputs are still available in the github.event.inputs context to maintain compatibility.
Read more >How to start using reusable workflows with GitHub Actions
Inputs are used to pass non-sensitive information while secrets are used to pass along sensitive information such as passwords and credentials.
Read more >Avoid Duplication! GitHub Actions Reusable Workflows
Note: if a required input has not been passed to the reusable workflow, it will fail. Other available types are boolean and number...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@galcohen-redislabs @jtmullen I ran into a similar issue, it appears that the type gets lost somewhere in the process and those input values become strings. As a workaround, you should be able to use
fromJSON
to convert them back to the appropriate type (e.g. number, boolean). For example, instead of this:give this a try:
@ruvceskistefan I am also still seeing this same issue:
Have a number input via workflow_dispatch that is being directly passed as an input to a reusable workflow:
The template is not valid. .....yml (Line: 29, Col: 23): Unexpected type of value '1', expected type: Number.