stop-covid19-sfbayarea
stop-covid19-sfbayarea copied to clipboard
Set-env command in GitHub actions is deprecated
Several of our actions workflows use the set-env
command to set environment variables for use in future steps of the workflow, but the set-env
command is now deprecated and will be removed in the future. More info about the change (it’s a security issue): https://github.blog/changelog/2020-10-01-github-actions-deprecating-set-env-and-add-path-commands/
We use it in several parts of all our workflows. Here’s one example: https://github.com/sfbrigade/stop-covid19-sfbayarea/blob/1622c0e987ffb2962a45f72a8070ce46167168aa/.github/workflows/data_update.yml#L55-L56
Instead of echo "::set-env name=<ENV_VAR_NAME>::<env_var_value>"
, we should now do echo "{name}={value}" >> $GITHUB_ENV
. See the docs here: https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#environment-files
So, for example, this code:
# Keep track of the version used so we can use it in commit messages
echo "::set-env name=SCRAPER_COMMIT::$(git rev-parse HEAD)"
Should probably now be something along the lines of:
# Keep track of the version used so we can use it in commit messages
echo "SCRAPER_COMMIT='$(git rev-parse HEAD)'" >> $GITHUB_ENV