diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2020-12-24 21:55:54 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2020-12-24 21:55:54 +0300 |
commit | 84eaf929144e40e16784ce145e6640736215a016 (patch) | |
tree | 74df70827f52f56b90a77899698b7b94fa4c0386 /action.yml | |
parent | /usr/local/bin should come first in PATH (diff) | |
download | setup-cygwin-84eaf929144e40e16784ce145e6640736215a016.tar.gz setup-cygwin-84eaf929144e40e16784ce145e6640736215a016.zip |
use well-known path to choco.exe if not in PATH
Diffstat (limited to 'action.yml')
-rw-r--r-- | action.yml | 15 |
1 files changed, 13 insertions, 2 deletions
@@ -29,9 +29,20 @@ runs: New-Variable install_dir -Value '${{ inputs.install-dir }}' -Option Constant New-Variable packages -Value '${{ inputs.packages }}' -Option Constant + function Locate-Choco { + $path = Get-Command 'choco' -ErrorAction SilentlyContinue + if ($path) { + $path.Path + } else { + Join-Path ${env:ProgramData} 'chocolatey' 'bin' 'choco' + } + } + if ($windows_host) { echo 'CYGWIN=${{ inputs.env }}' >> $env:GITHUB_ENV + $choco = Locate-Choco + $choco_params = @( 'install', '-y', @@ -44,7 +55,7 @@ runs: $choco_params += 'cygwin' # Assuming that Cygwin is not installed when this is run. - choco.exe $choco_params + & $choco $choco_params # /usr/bin is really just /bin on Cygwin. echo (Join-Path $install_dir bin) >> $env:GITHUB_PATH @@ -53,7 +64,7 @@ runs: $pkg_list = $packages.Split(' ', [System.StringSplitOptions]::RemoveEmptyEntries) if ($pkg_list.Count -gt 0) { - choco.exe install -y --no-progress --source=cygwin $pkg_list + & $choco install -y --no-progress --source=cygwin $pkg_list } } else { throw "Sorry, installing Cygwin is unsupported on $os" |