Print Single or All Environment Variables With GitHub Actions

This post will show how to print a single or all the environment variables available in GitHub Actions runner.

GitHub Actions workflows come with many environment variables that allow us to access them and use them during runtime or on different workflow stages.

Note: Default environment variables are case sensitive.


In the following workflow, we are printing the github.sha commit id, which is an environment variable. In the last line of the workflows, we are printing all the environment variables available on a Ubuntu runner.

Note: To print all the environment variables on a Windows runner, change the runs-on to windows-latest.

name: Print a single or all environment variables
on: push


    runs-on: ubuntu-latest
      - name: Check out repo        
        uses: actions/checkout@v2
      - run: echo " Print a single environment variable (the commit SHA ) - ${{ github.sha }} "
      - run: echo "Print all environment variables"
      - run:  env