jobs.<job_id>.env

1 minute read

Use jobs.<job_id>.env to define variables for all steps in a job. You can also set variables for the entire workflow or for an individual step.

env variables with the same name follow specificity precedence. In the following example, the environment variable SERVER: development defined in a step overrides SERVER: production defined in my-job, while the step executes.

my-job:
  env:
    SERVER: production
  steps:
    - name: My first step
      env:
        SERVER: development
      uses: docker://alpine:3.18
      run: echo "Hello $SERVER" #prints "Hello development"
    - name: My second step
      uses: docker://alpine:3.18
      run: echo "Hello $SERVER" #prints "Hello production"