Deprecating set-env and add-path commands, alternative?

I am trying to remove this warning from a github action:

Warning: The `set-env` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see:

I have upgraded the @actions/core package to version 1.2.6 - but is that enough?

The code in question looks like this: core.exportVariable('npm_config_cache', npmCacheFolder) - should that be re-written, and in that case how should it look like :face_with_monocle:?

The changelog entry has links to the replacement, which is writing to special files.

Thanks for providing the link @airtower-luna . How would that look like in a Github action written in javascript, with the @actions/core package?

I just imagine something like this would be wrong?

const execSync = require('child_process').execSync;
execSync(`echo "npm_config_cache =${npmCacheFolder}" >> $GITHUB_ENV`);

Should this not be done with some method from the @actions/core package?

1 Like

@airtower-luna do you know the answer here - or can someone else give some insights?

Upgrading the toolkit for your action should be sufficient. The method abstracts the implementation.

1 Like