GitHub Actions Certification — Question 7
Which statement is true about using default environment variables?
Answer options
- A. The environment variables can be read in workflows using the ENV: variable_name syntax.
- B. The environment variables created should be prefixed with GITHUB_ to ensure they can be accessed in workflows
- C. The environment variables can be set in the defaults: sections of the workflow
- D. The GITHUB_WORKSPACE environment variable should be used to access files from within the runner.
Correct answer: D
Explanation
The correct answer is D because the GITHUB_WORKSPACE variable specifically provides the path to the workspace directory within the runner. Options A, B, and C are incorrect as they either misrepresent how to access environment variables or describe settings that are not true regarding default environment variables.