If you generate a value in one step of a job, you can use the value in subsequent steps of the same job by assigning the value to an existing or new environment variable and then writing this to the GITHUB_ENV environment file.
You can set your own custom variables or use the default environment variables that GitHub sets automatically.
You can set a custom variable in two ways.
You can define variables that are scoped for:
job within a workflow
specific step within a job
You can access env variable values using runner environment variables or using contexts
The commands in the run steps of a workflow, or a referenced action, are processed by the shell you are using on the runner
The instructions in the other parts of a workflow are processed by GitHub Actions and are not sent to the runner
You can use either runner environment variables or contexts in run steps, but in the parts of a workflow that are not sent to the runner you must use contexts to access variable values.
Because runner environment variable interpolation is done after a workflow job is sent to a runner machine, you must use the appropriate syntax for the shell that's used on the runner
When you set an environment variable, you cannot use any of the default environment variable names.
If you attempt to override the value of one of these default variables, the assignment is ignored.
The GITHUB_ENV and GITHUB_WORKSPACE default variables are exceptions to this convention.
Glasp is a social web highlighter that people can highlight and organize quotes and thoughts from the web, and access other like-minded people’s learning.