-
Notifications
You must be signed in to change notification settings - Fork 65.8k
Description
Code of Conduct
- I have read and agree to the GitHub Docs project's Code of Conduct
What article on docs.github.com is affected?
https://docs.github.com/en/actions/learn-github-actions/contexts#example-usage-of-the-vars-context
What part(s) of the article would you like to see updated?
To article states "This example workflow shows how configuration variables set at the repository, environment, or organization levels are automatically available using the vars context."
This is not acurate. In the below example where vars.RUNNER is variables defined in the environement dev (that is to say not at the repository or organisation level) then vars.RUNNER will not be evaluated and you can expect an error like:
Error when evaluating 'runs-on' for job 'test-job'. .github/workflows/test-job.yaml (Line: 26, Col: 14): Unexpected value ''
test-job:
name: "Can echo Hello World!"
environment: "dev"
runs-on: ${{vars.RUNNER}}
steps:
- name: hello-world
run: echo "Hello World!"
It seems to me either the article is incorrect or there is a bug in the github actions engine as the described behaviour is not acurate.
Additional information
To reproduce
- create a new workflow
name: "Runner var test"
on:
workflow_dispatch:
jobs:
hello-world-job:
name: "Can echo Hello World!"
environment: "dev"
runs-on: ${{vars.RUNNER}}
steps:
- name: hello-world
run: echo "Hello World!"
- Create and environment in the repository and add a variable called
RUNNERwith a value ofubuntu-latest - Run the Workflow and observe it failing in