Sybuser
Sybuser

Reputation: 1382

How do I use the user home directory in a Github actions workflow that runs on Windows?

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.

Upvotes: 1

Views: 6083

Answers (1)

Sybuser
Sybuser

Reputation: 1382

The answer is $HOME :

steps:
- name: Echo home
  run: 
    echo $HOME

Log:

Run echo $HOME
C:\Users\runneradmin

Upvotes: 4

Related Questions