Search code examples
github-actions

What contexts can be used when setting a GitHub Action job name?


I'd like to set a GitHub Action job name using the value of a variable set in the environment, but the following straightforward approach fails with an error about Unrecognized named-value: 'env':

env:
  SERVER: https://example.com

...

jobs:
  Send_to_server:
    name: "Send to ${{env.SERVER}}"
    runs-on: ubuntu-latest
    steps:
      ...

In GitHub's documentation, there is an example of using the vars context and another example of using the strategy context. Based on the error I get, I guess the env context cannot be used in this situation. What other contexts can be used in the definition of the job name?


Solution

  • jobs.<job_id>.name has github, needs, strategy, matrix, vars and inputs contexts.


    This is normally written in the documentation as it varies for the different places.

    From the link in your question:

    For details of where you can use various contexts within a workflow, see "Contexts."

    That is linked to https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability and titled Context availability.

    Search the table in that section for location you're interested in.