Merge pull request #2 from actions/v-malob/runner-toolcache

Use $RUNNER_TOOL_CACHE for GitHub images to install Node.js
This commit is contained in:
Maxim Lobanov 2020-04-21 21:21:54 +03:00 committed by GitHub
commit f59378e9e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,7 +4,12 @@ $ErrorActionPreference = "Stop"
$ArchiveFileName = "tool.7z" $ArchiveFileName = "tool.7z"
$TempDirectory = Join-Path $env:TEMP "Node" $TempDirectory = Join-Path $env:TEMP "Node"
$NodeToolcachePath = Join-Path -Path $env:AGENT_TOOLSDIRECTORY -ChildPath "node" $ToolcacheRoot = $env:AGENT_TOOLSDIRECTORY
if ([string]::IsNullOrEmpty($ToolcacheRoot)) {
# GitHub images don't have `AGENT_TOOLSDIRECTORY` variable
$ToolcacheRoot = $env:RUNNER_TOOL_CACHE
}
$NodeToolcachePath = Join-Path -Path $ToolcacheRoot -ChildPath "node"
$NodeToolcacheVersionPath = Join-Path -Path $NodeToolcachePath -ChildPath $Version.ToString() $NodeToolcacheVersionPath = Join-Path -Path $NodeToolcachePath -ChildPath $Version.ToString()
$NodeToolcacheArchitecturePath = Join-Path $NodeToolcacheVersionPath $Architecture $NodeToolcacheArchitecturePath = Join-Path $NodeToolcacheVersionPath $Architecture