docs
docs copied to clipboard
Clarify that env vars are at least somewhat case insensitive on Windows
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/using-workflows/workflow-commands-for-github-actions#setting-an-environment-variable
What part(s) of the article would you like to see updated?
The names of environment variables are case-sensitive, and you can include punctuation.
This is true on Linux (and macOS).
However, my understanding is that this is at least partially untrue on Windows: https://github.com/actions/runner/blob/cb19da9638790019f6e7be193cd4282311992b12/src/Runner.Worker/ActionCommandManager.cs#L158-L162
I say partially, because I haven't extensively tested the code paths.
Additional information
No response
👋 @jsoref Thanks so much for opening an issue! I'll triage this for the team to take a look :eyes:
Thanks for opening an issue! We've triaged this issue for technical review by a subject matter expert :eyes:
This probably needs some engineering clarification; environment variables on Windows platforms are not case-sensitive, but I'm not sure that when those environment variables are used by any Actions components (e.g. setting them in $env:GITHUB_ENV
) whether there might be cases where they are.
Technically environment variables in cmd are case-preserving:
set X=1 && set y=2 && echo Unset %x% %Y%.
echo Set %X% %y%. && set x=3 && echo %X% && set|find "X=" && set|find "y=" && echo --- && set|find "x=" && set |find "Y=" && echo ===
And the same applies for PowerShell:
$Env:TestOne=1
$Env:TestTWO=2
$Env:TestONE
$Env:Testtwo
$Env:TestOnE=3
$Env:TestOne
But yes, it'd be good to get engineering input. I can only speak to the general bits that I can read or test and not anything beyond that.
This is a gentle bump for the docs team that this issue is waiting for technical review.
This is a gentle bump for the docs team that this issue is waiting for technical review.
This is a gentle bump for the docs team that this issue is waiting for technical review.
This is a gentle bump for the docs team that this issue is waiting for technical review.
This is a gentle bump for the docs team that this issue is waiting for technical review.
This is a gentle bump for the docs team that this issue is waiting for technical review.
@cmwilson21 ...
Reopened! Sorry about that!
I got Engineering to look into this.
After testing various runner OSes, the feedback is that, practically speaking, environment variables are case sensitive on Linux and Mac, and case insensitive on Windows runners.
If you choose to use Powershell as your shell on Linux or Mac environment variables are still case sensitive (i.e. this doesn't break the above rule). See the note here: https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_environment_variables?view=powershell-7.3#long-description
We should, therefore, update the documentation where we currently say that "environment variables are case-sensitive", as this is not true for Windows.
Engineering made a couple of points that we should include when updating the docs:
-
To avoid issues it's good practice to treat environment variables as case sensitive irrespective of the behavior of the operating system and shell you are using. We should make this point when talking about case sensitivity of environment variables.
-
In a couple of Markdown files:
- https://docs.github.com/en/actions/hosting-your-own-runners/managing-self-hosted-runners/using-a-proxy-server-with-self-hosted-runners#configuring-a-proxy-server-using-environment-variables
- https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#example-of-a-workflow-command
and in this reusable:
- https://github.com/github/docs/blob/main/data/reusables/actions/actions-secrets-and-variables-naming.md?plain=1
we use the phrase "not case-sensitive" - we should change this to "case insensitive".
BTW: we don't need to hyphenate "case sensitive" where it's not being used as an adjective.