I'm using the Github actions workflow that runs on windows-latest and I'd like to use the user home directory variable instead of using an hardcoded path C:\Users\runneradmin
. On windows this is normally available in a cmd as %USERPROFILE%
.
But using %USERPROFILE%
fails in the Github actions as the syntax seems unsupported.
Also tried : ${{ env.USERPROFILE }}
which was empty.
and $env:USERPROFILE
which resulted in syntax error.
The answer is $HOME
:
steps:
- name: Echo home
run:
echo $HOME
Log:
Run echo $HOME
C:\Users\runneradmin