timeout-minutes should allow for inputs parameter.
Describe the bug
step/job timeout-minutes only supports number and the runner will not run the workflow with an configurable inputs timeout.
timeout-minutes: ${{ inputs.test-timeout }}
To Reproduce
name: DotNet Test
on:
workflow_call:
inputs:
test-timeout:
required: false
type: number
default: 10
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Test
timeout-minutes: ${{ inputs.test-timeout }}
run: |
dotnet test
Expected behavior With reusable workflows I would hope that I was allowed to pass a timeout-minutes as configurable.
Runner Version and Platform
N/A
What's not working?
inputs.test-timeout specshell/.github/.github/workflows/dotnet-build.yml@main (Line: 98, Col: 26): Unexpected value '${{ inputs.test-timeout }}'
Job Log Output
N/A
Runner and Worker's Diagnostic Logs
N/A
I thought this was just documentation bug like for concurrency ( which accepts inputs, even if the documentations tells the opposite ), but you are right the official actions service blocks inputs as valid context and refuse to process your workflow.
Simple Workaround via matrix
name: DotNet Test
on:
workflow_call:
inputs:
test-timeout:
required: false
type: number
default: 10
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
test-timeout:
- ${{ inputs.test-timeout }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Test
timeout-minutes: ${{ matrix.test-timeout }}
run: |
dotnet test
The actions/runner accepts and runs your job with inputs in timeout-minutes, I tested it
great that a workaround exist but that just shows it should also allow inputs
@ericsciple does the service pass down the inputs context to the runner for reusable workflow?
I just ran into this issue trying with a reusable workflow. I wanted a parent workflow to have control over an action defined by the reusable workflow. Attempts to make the timeout-minutes value process an input value result in:
Unrecognized named-value: 'inputs'.
Mine seemed to work with timeout-minutes: ${{ input.timeout-minutes }} directly (still with an explicit input).
For me, it works as well, removing the workaround yields a working build still. And now that I see it, we actually have not been using the workaround in newly created workflows, at least since last November.
Maybe they fixed it without closing this issue?
It works but the schema is still broken causing linting errors: https://json.schemastore.org/github-workflow.json
I don't think number is a valid input type...
input type of workflow_dispatch event must be one of "string", "boolean", "choice", "environment" but got "number" [syntax-check]
|
46 | type: number
Hey all, This issue does not seem to be a problem with the runner application, it concerns the GitHub actions platform more generally. Could you please post your feedback on the GitHub Community Support Forum which is actively monitored. Using the forum ensures that we route your problem to the correct team. 😃
@ljharb @jetersen @Piedone I am trying to the same but keep getting error. Can anyone post how we can set the timeout using the input parameter please
I'm also having troubles with this, this is the error I get:
Error when evaluating 'timeout-minutes' for job 'xxx'. .github/workflows/xxx.yaml (Line: 14, Col: 22): Unexpected value '10'
I found the solution you can use fromJSON.
https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/evaluate-expressions-in-workflows-and-actions#fromjson
name: DotNet Test
on:
workflow_call:
inputs:
test-timeout:
required: false
type: number
default: 10
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Test
timeout-minutes: ${{ fromJSON(inputs.test-timeout) }}
run: |
dotnet test
If you also have some other triggers like pull_request or push, where you lack input context, you can preserve the default value like this:
timeout-minutes: ${{ fromJSON(inputs.test-timeout || '10') }}
It seems the "completed" label is misleading. @ruvceskistefan can you please update it?