Print variable set in $GITHUB_ENV #26392
-
How do I get the value of an environment variable set in For eg - Now I want to do - |
Beta Was this translation helpful? Give feedback.
Replies: 7 comments
-
Could you post the context from your workflow file? That should work, assuming the second command is in another |
Beta Was this translation helpful? Give feedback.
-
You might want to set it as output so that you can explicitly reference and set it as env instead. But would need to see your workflow to better understand the problem. Do you use PowerShell by any chance? |
Beta Was this translation helpful? Give feedback.
-
This is my config file - https://github.com/reikdas/cling-1/blob/090f490dae44e7f4857ac9310d2c01724f9ef3aa/.github/workflows/ci.yml (Note where I try
Simran-B:
No. Bash. |
Beta Was this translation helpful? Give feedback.
-
I see the problem there: The
|
Beta Was this translation helpful? Give feedback.
-
If you only need an environment variable within the current step, then there is no need to involve GITHUB_ENV at all. But I guess some of the commands in later steps take CC and CXX into account? To make
|
Beta Was this translation helpful? Give feedback.
-
Here is how to do it in powershell 5.1 or newer
|
Beta Was this translation helpful? Give feedback.
-
I wouldn’t recommend
I suppose in PowerShell Core (
Nonetheless, the official recommendation is:
It doesn’t say whether this is for the legacy PowerShell only, but it might. |
Beta Was this translation helpful? Give feedback.
I see the problem there: The
$CC --version
is part of the same steps the set writeCC
toGITHUB_ENV
. That’s not going to work, you can only use it in later steps. So, remove that command from the “setup compiler” steps, and add one like this after them: