env key

The workflow key that sets environment variables for every step of a workflow, a job, or a single step.

In more detail

Setting a value on the step that needs it keeps it out of every other step. Passing event data and secrets through env, rather than writing an expression straight into a shell command, also avoids script injection.

Example

env:
  API_TOKEN: ${{ secrets.API_TOKEN }}

Related terms

Taught in

References

Certification courses