Environment variables
-
env
-
GITHUB_*are reserved.
env:
DEMO_FIELD: value
name: Environment Variables
on:
push:
workflow_dispatch:
# We can set an environment variable for
# - the whole file (all the jobs)
# - for a job
# - for a single step
env:
DEMO: "File level"
jobs:
global:
runs-on: ubuntu-latest
steps:
- name: Show the environment variable we set for the file
run: |
echo $DEMO
- name: Show the environment variable we set inside this step
env:
DEMO: "Step level"
run: |
echo $DEMO
other:
runs-on: ubuntu-latest
env:
DEMO: "Job level"
steps:
- name: Show job level variable
run: |
echo $DEMO
- name: Show step level variable
env:
DEMO: "Step level"
run: |
echo $DEMO
all:
runs-on: ubuntu-latest
steps:
- name: Show all the environment variables set by GitHub Actions
run: printenv | sort