docs
docs copied to clipboard
How to properly escape values for $GITHUB_ENV file
Code of Conduct
- [X] I have read and agree to the GitHub Docs project's Code of Conduct
What article on docs.github.com is affected?
https://docs.github.com/en/actions/learn-github-actions/workflow-commands-for-github-actions#environment-files
What part(s) of the article would you like to see updated?
I'm missing explanation how to properly escape values written to $GITHUB_ENV file. It would be also helpful to describe how this file is read.
Additional information
I'm writing this issue based on my current experience.
I'm trying to set environment variable with value which starts with $ and so far I haven't been able to do so.
Please see following workflow file as example: https://github.com/klinki/github-actions-for-packages/blob/main/.github/workflows/test-env-vars.yml
Edited by maintainer
Content Plan
Here is the writer's content plant for this issue
Thanks for opening this issue. A GitHub docs team member should be by to give feedback soon. In the meantime, please check out the contributing guidelines.
@klinki Thanks so much for opening an issue! I'll triage this for the team to take a look :eyes:
Thanks for opening this issue! I'm not sure how to do this either, but I agree it would be helpful to document. I reached out to the Actions team to ask.
However, this question might be a better fit GitHub Support or GitHub Community.
Update: You can use single quotes instead of double quotes to achieve this. e.g. This worked for me:
steps:
- shell: pwsh
run: |
echo 'action_state=$yellow' >> $GITHUB_ENV
- shell: pwsh
run: |
echo IT IS '${{ env.action_state }}'
You or anyone else is welcome to open a PR to add this information to the docs.
Can I add it? :) if @klinki isn't making a PR then I can work on this :).
@ArkaprabhaChakraborty please feel free to work on this, it has been a while and I'm quite out of a loop of this particular issue now.
@ArkaprabhaChakraborty - You, or anyone else, are welcome to work on this!
Thanks for your interest in improving the docs!
Can I add it? :) if @klinki isn't making a PR then I can work on this :).
- [ ] #-@