GH-200 practice question 5 of 15
Which default environment variable specifies the branch or tag that triggered a workflow?
Full set: 100 questionsGitHub Actions automatically populates a set of default environment variables for every workflow run. The GITHUBREF variable contains the fully-qualified reference (ref) of the branch or tag that triggered the workflow. For a branch, its format is refs/heads/, and for a tag, it is refs/tags/. This makes it the definitive variable for identifying the exact source ref.
A. GITHUBTAG is a deprecated variable; the modern equivalent for just the name is GITHUBREFNAME. GITHUBREF is the correct, comprehensive variable.
C. ENVBRANCH is not a standard default environment variable provided by GitHub Actions.
D. GITHUBBRANCH is not a standard default environment variable. The GITHUBREFNAME variable provides just the branch or tag name.
- GitHub Docs. (2024). "Using environment variables." In Guides. Retrieved from https://docs.github.com/en/actions/learn-github-actions/variables#default-environment-variables. The table of default variables lists GITHUBREF and describes it as "The branch or tag ref that triggered the workflow run."
Keep practicing
Take the free GH-200 practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other GH-200 practice questions
- Question 1Which action type should be used to bundle a series of run steps into a reusable custom a…
- Question 2As a developer, which workflow steps should you perform to publish an image to the GitHub…
- Question 3Where should workflow files be stored to be triggered by events in a repository?
- Question 6As a developer, what is the safest way to reference an action to prevent modification of …
- Question 7Without the need to use additional infrastructure, what is the simplest and most maintain…
- Question 8Disabling a workflow allows you to stop a workflow from being triggered without having to…
