Default PowerShell Paths (PSModulePath) on GitHub Runners
If you're curious about the $Env:PSModulePath
for GitHub Runners, here's what I came up with after running a workflow.
Knowing the $Env:PSModulePath
of each runner can be useful for making specific types of GitHub Actions. I used it within my own GitHub Action, psmodulecache which makes caching PowerShell modules from the PowerShell Gallery easy for Linux, Windows and macOS runners.
macoS
1/Users/runner/.local/share/powershell/Modules:/usr/local/share/powershell/Modules:/usr/local/microsoft/powershell/7/Modules
/Users/runner/.local/share/powershell/Modules
is CurrentUser
and the other paths are system paths, acessible by all users. That also aligns with a path within my macmini's pwsh path.
Linux
1/home/runner/.local/share/powershell/Modules:/usr/local/share/powershell/Modules:/opt/microsoft/powershell/7/Modules
/Users/runner/.local/share/powershell/Modules
is CurrentUser
and the other paths are system paths, acessible by all users. That also aligns with a path on my rando Ubuntu install.
Windows
1C:\Users\runneradmin\Documents\PowerShell\Modules;C:\Program Files\PowerShell\Modules;c:\program files\powershell\7\Modules;C:\\Modules\azurerm_2.1.0;C:\\Modules\azure_2.1.0;C:\Users\packer\Documents\WindowsPowerShell\Modules;C:\Program Files\WindowsPowerShell\Modules;C:\Windows\system32\WindowsPowerShell\v1.0\Modules;C:\Program Files\Microsoft SQL Server\130\Tools\PowerShell\Modules\
C:\Users\runneradmin\Documents\PowerShell\Modules
is CurrentUser
and the other paths are likely system paths.