Skip to content

Can I access the value in an env file from a python script using os.getenv? #25415

Answered by BrightRan
Siedlerchr asked this question in Actions
Discussion options

You must be logged in to vote

@siedlerchr,

Sure, using “os.getenv(‘ENV_NAME’)” or “os.environ[‘ENV_NAME’]” in Python scripts to access environment variables still can work.

In addition, the old workflow command (echo “::set-env name={name}::{value}”) to set an environment variable has been deprecated.
Currently, the old command still can work in the workflows, however we recommend that you use the new command (echo “{name}={value}” >> $GITHUB_ENV).
More details, see “Setting an environment variable”.

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
3 participants