In 2020 GitHub changed the recommended practice for dynamically setting environment variables because of a security vulnerability: GitHub Actions: Deprecating set-env and add-path commands

I missed this until I noticed console warnings.

However, sometimes I like to check the environment variable I’ve just set, and this model of piping to a file inspired me.

Instead of a simple append operation:

name: Set Environment
-  run: echo "MY_VARIABLE=${PWD}/cool/data/path" >> $GITHUB_ENV

You can both append and see the result by using tee -a:

name: Set Environment
-  run: echo "MY_VARIABLE=${PWD}/cool/data/path" | tee -a $GITHUB_ENV