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

How to properly escape values for $GITHUB_ENV file #10788

Closed
1 task done
klinki opened this issue Oct 6, 2021 · 8 comments · Fixed by #21582
Closed
1 task done

How to properly escape values for $GITHUB_ENV file #10788

klinki opened this issue Oct 6, 2021 · 8 comments · Fixed by #21582
Labels
actions This issue or pull request should be reviewed by the docs actions team content This issue or pull request belongs to the Docs Content team good first issue Good for newcomers help wanted Anyone is welcome to open a pull request to fix this issue.

Comments

@klinki
Copy link

klinki commented Oct 6, 2021

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

@klinki klinki added the content This issue or pull request belongs to the Docs Content team label Oct 6, 2021
@welcome
Copy link

welcome bot commented Oct 6, 2021

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.

@github-actions github-actions bot added the triage Do not begin working on this issue until triaged by the team. label Oct 6, 2021
@github-actions github-actions bot added this to Triage in Docs open source board Oct 6, 2021
@ramyaparimi ramyaparimi added actions This issue or pull request should be reviewed by the docs actions team and removed triage Do not begin working on this issue until triaged by the team. labels Oct 6, 2021
@ramyaparimi ramyaparimi moved this from Triage to Content review needed in Docs open source board Oct 6, 2021
@ramyaparimi ramyaparimi added waiting for review Issue/PR is waiting for a writer's review and removed waiting for review Issue/PR is waiting for a writer's review labels Oct 6, 2021
@ramyaparimi
Copy link
Contributor

@klinki
Thanks so much for opening an issue! I'll triage this for the team to take a look 👀

@skedwards88
Copy link
Contributor

skedwards88 commented Nov 20, 2021

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.

@skedwards88
Copy link
Contributor

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.

@skedwards88 skedwards88 added the help wanted Anyone is welcome to open a pull request to fix this issue. label Nov 20, 2021
@docubot docubot moved this from Content review needed to Help wanted in Docs open source board Nov 20, 2021
@ramyaparimi ramyaparimi removed the waiting for review Issue/PR is waiting for a writer's review label Jan 13, 2022
@ramyaparimi ramyaparimi added the good first issue Good for newcomers label Jan 26, 2022
@ArkaprabhaChakraborty
Copy link

Can I add it? :) if @klinki isn't making a PR then I can work on this :).

@klinki
Copy link
Author

klinki commented Oct 15, 2022

@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.

@cmwilson21
Copy link
Contributor

@ArkaprabhaChakraborty - You, or anyone else, are welcome to work on this!

Thanks for your interest in improving the docs!

@Rs4178

This comment was marked as spam.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
actions This issue or pull request should be reviewed by the docs actions team content This issue or pull request belongs to the Docs Content team good first issue Good for newcomers help wanted Anyone is welcome to open a pull request to fix this issue.
Development

Successfully merging a pull request may close this issue.

7 participants
@klinki @skedwards88 @ramyaparimi @ArkaprabhaChakraborty @cmwilson21 @Rs4178 and others