Cannot set default.timeout-minutes

Looking at https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#defaults it seems like I should be able to define a default timeout-minutes that will be applied to each job, however, when I have:

defaults:
  timeout-minutes: 15

In the workflow, it reports that the key was unexpected:

 Invalid workflow file

The workflow is not valid. .github/workflows/code.yml (Line: 14, Col: 3): Unexpected value 'timeout-minutes'

Should I be able to set that key there? If not, I think the documentation for defaults could use a little more clarification as to what keys are allowed.

2 Likes

It might be a syntax issue – could you try something like this?

jobs:
  Test:
    - name: Run test
      timeout-minutes: 10
      run: make unit-test

If that doesn’t work, could you share a copy of your workflow .yml file?

Thanks for the response! We are able to set the value at the job level, but this requires setting the timeout for every job we add.

The documentation for defaults says:

A map of default settings that will apply to all jobs in the workflow. You can also set default settings that are only available to a job. For more information, see jobs.<job_id>.defaults .

https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#defaults

Which made me think I could set the timeout-minutes there and have it apply to each job, but this does not appear to be the case. Could you clarify which keys are able to be set in defaults?

Currently, only defaults.run is supported .
I would encourage you to share your requirement for timeout-minutes in the Feedback form for GitHub Actions.

Aha, I see, thanks for clarifying. I was thinking that defaults.run was simply expanded documentation for that default but I see that it is the only supported option. I think the documentation could be clearer to that point. I’ll fill out the feedback form.

Thank you!

1 Like