runner icon indicating copy to clipboard operation
runner copied to clipboard

timeout-minutes should allow for inputs parameter.

Open jetersen opened this issue 4 years ago • 15 comments

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

jetersen avatar Dec 13 '21 09:12 jetersen

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

ChristopherHX avatar Dec 13 '21 10:12 ChristopherHX

great that a workaround exist but that just shows it should also allow inputs

jetersen avatar Dec 13 '21 11:12 jetersen

@ericsciple does the service pass down the inputs context to the runner for reusable workflow?

TingluoHuang avatar Dec 13 '21 17:12 TingluoHuang

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'.

jessemyers avatar Dec 15 '21 22:12 jessemyers

Mine seemed to work with timeout-minutes: ${{ input.timeout-minutes }} directly (still with an explicit input).

ljharb avatar Feb 06 '23 21:02 ljharb

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.

Piedone avatar Feb 06 '23 21:02 Piedone

Maybe they fixed it without closing this issue?

jetersen avatar Feb 09 '23 12:02 jetersen

It works but the schema is still broken causing linting errors: https://json.schemastore.org/github-workflow.json

rehangit avatar Feb 27 '23 11:02 rehangit

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
 

thejeff77 avatar Feb 28 '23 20:02 thejeff77

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. 😃

ruvceskistefan avatar May 24 '23 08:05 ruvceskistefan

@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

vrathore18 avatar Jul 11 '24 11:07 vrathore18

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'

broskoTT avatar Nov 21 '24 11:11 broskoTT

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

giginet avatar Jan 22 '25 01:01 giginet

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') }}

broskoTT avatar Jan 23 '25 20:01 broskoTT

It seems the "completed" label is misleading. @ruvceskistefan can you please update it?

ulgens avatar Jun 26 '26 21:06 ulgens