docs icon indicating copy to clipboard operation
docs copied to clipboard

Contexts available for jobs.<job_id>.defaults.run.shell

Open phdru opened this issue 1 year ago • 4 comments
trafficstars

Code of Conduct

What article on docs.github.com is affected?

https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions

What part(s) of the article would you like to see updated?

The section jobs.<job_id>.defaults.run.shell says

This keyword can reference several contexts. For more information, see "Contexts."

But the page "Contexts" doesn't mention keyword "shell" at all.

Please update the page "Contexts" to include context(s) available for jobs.<job_id>.defaults.run.shell.

If no contexts are available (I tried matrix and runner, both failed) please document that at the page jobs.<job_id>.defaults.run.shell.

Additional information

No response

phdru avatar Jul 22 '24 12:07 phdru

Thanks for opening this issue. A GitHub docs team member should be by to give feedback soon. In the meantime, please check out the contributing guidelines.

welcome[bot] avatar Jul 22 '24 12:07 welcome[bot]

@phdru Thanks so much for opening an issue! I'll get this triaged for review ✨

nguyenalex836 avatar Jul 22 '24 16:07 nguyenalex836

And BTW, page jobs.<job_id>.steps[*].shell doesn't mentions any contexts at all. It should IMO.

To explain what I want: I need to calculate system-specific shell:

    shell: ${{ matrix.os-name == 'w32' && 'cmd /C call {0}' || 'bash -el {0}' }}

or

    shell: ${{ runner.os == 'Windows' && 'cmd /C call {0}' || 'bash -el {0}' }}

Neither work so I want to know what contexts are available.

phdru avatar Jul 23 '24 10:07 phdru

Thanks for opening an issue! We've triaged this issue for technical review by a subject matter expert :eyes:

github-actions[bot] avatar Aug 22 '24 16:08 github-actions[bot]

Hi @phdru 👋🏻

The table on Context availability shows the field where a context is available. The context will also be available for any subfields of that field.

In this case, jobs.<job_id>.defaults.run and all subfields, including shell, can access the following contexts: github, needs, strategy, matrix, env, vars, inputs.

felicitymay avatar Sep 02 '24 10:09 felicitymay

Ok, thank you for explanation!

phdru avatar Sep 02 '24 11:09 phdru