Closed devblackops closed 5 years ago
Interesting - is git not available? I think that just runs ‘get-command git’, picks first in case multiple results come back (that’s where error is coming up - indexing into nothing)
Ah ya, right...git is probably not on the image I'm using (mcr.microsoft.com/powershell:6.1.0-ubuntu-18.04
). I'll add that and try again. Thanks!
git won't be there, but seems like we could:
$GitPath = @(Get-Command $GitPath -ErrorAction SilentlyContinue)[0].Path
(the array @
is new), or
$GitPath = (Get-Command $GitPath -ErrorAction SilentlyContinue | Select-Object -First 1).Path
That said, yeah, if git not available, you'll lose some of the functionality if it isn't mapped to an expected env variable... We should definitely add GitHub Actions support! https://developer.github.com/actions/creating-github-actions/accessing-the-runtime-environment/#environment-variables
Failing gracefully would be nice. And having official support for Action env vars would be sweet!
This is more of an FYI.
I'm experimenting with various PowerShell use cases in GitHub Actions and some of them use
BuildHelpers
to determine some folder paths. I receive the following error when runningSet-BuildEnvironment -Force
when run within an Action.I'm going to dig into this more and hopefully submit a fix.