GH-200 · Question #76
What is the smallest scope for an environment variable?
The correct answer is D. a step. GitHub Actions supports environment variable scoping at three levels: workflow-level (env: at the top of the workflow file, available to all jobs and steps), job-level (env: under a job definition, available to all steps in that job), and step-level (env: under a specific step, a
Question
What is the smallest scope for an environment variable?
Options
- Athe workflow settings
- Bthe workflow env mapping
- Ca job
- Da step
How the community answered
(18 responses)- A6% (1)
- C6% (1)
- D89% (16)
Explanation
GitHub Actions supports environment variable scoping at three levels: workflow-level (env: at the top of the workflow file, available to all jobs and steps), job-level (env: under a job definition, available to all steps in that job), and step-level (env: under a specific step, available only to that single step). The step is the smallest scope - an environment variable defined at the step level cannot be accessed by other steps or jobs. This scoping model allows precise control over variable visibility.
Topics
Community Discussion
No community discussion yet for this question.