nerdexam
Microsoft

GH-200 · Question #6

What is the proper syntax to reference the system-provided run number variable?

The correct answer is D. ${{GITHUB_RUN_NUMBER}}. Default environment variables The default environment variables that GitHub sets are available to every step in a workflow. Because default environment variables are set by GitHub and not defined in a workflow, they are not accessible through the env context [Not B]. However…

Author and Maintain Workflows

Question

What is the proper syntax to reference the system-provided run number variable?

Options

  • A${{var.GITHUB_RUN_NUMBER}}
  • B${{env.GITHUB_RUN_NUMBER}}
  • C$GITHUB_RUN_NUMBER
  • D${{GITHUB_RUN_NUMBER}}
  • E$github.run_number

How the community answered

(22 responses)
  • C
    5% (1)
  • D
    91% (20)
  • E
    5% (1)

Explanation

Default environment variables The default environment variables that GitHub sets are available to every step in a workflow. Because default environment variables are set by GitHub and not defined in a workflow, they are not accessible through the env context [Not B]. However, most of the default variables have a corresponding, and similarly named, context property. For example, the value of the GITHUB_REF variable can be read during workflow processing using the ${{ github.ref }} context https://docs.github.com/en/actions/reference/workflows-and-actions/variables

Topics

#GitHub Actions#Workflow expressions#System variables#Variable referencing

Community Discussion

No community discussion yet for this question.

Full GH-200 Practice