Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set-env command in GitHub actions is deprecated #495

Open
Mr0grog opened this issue Oct 14, 2020 · 2 comments
Open

Set-env command in GitHub actions is deprecated #495

Mr0grog opened this issue Oct 14, 2020 · 2 comments

Comments

@Mr0grog
Copy link
Collaborator

Mr0grog commented Oct 14, 2020

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:

# Keep track of the version used so we can use it in commit messages
echo "::set-env name=SCRAPER_COMMIT::$(git rev-parse HEAD)"

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
@kengoy
Copy link
Collaborator

kengoy commented Oct 18, 2020

I changed our all github action scripts not to use set-env but it still shows the warnings as well as add-path. Hmm...

@Mr0grog
Copy link
Collaborator Author

Mr0grog commented Oct 19, 2020

Ahhhh, they are coming from the peter-evans/create-pull-request action:

Screen Shot 2020-10-18 at 9 32 44 PM

It looks like we are no longer on the latest version (we’re on v2, the latest is v3), so hopefully upgrading will fix it. Upgrade guide here, it looks like we shouldn’t have to change anything: https://github.com/peter-evans/create-pull-request/blob/master/docs/updating.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants