From 28a02567223df9029e17884a0bb6e61d836c2e46 Mon Sep 17 00:00:00 2001 From: Maxim Lobanov Date: Tue, 21 Apr 2020 20:49:59 +0300 Subject: [PATCH] Use $RUNNER_TOOL_CACHE for GitHub images to install Node.js --- installers/win-setup-template.ps1 | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/installers/win-setup-template.ps1 b/installers/win-setup-template.ps1 index 5148b35..e9bb2fd 100644 --- a/installers/win-setup-template.ps1 +++ b/installers/win-setup-template.ps1 @@ -4,7 +4,12 @@ $ErrorActionPreference = "Stop" $ArchiveFileName = "tool.7z" $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() $NodeToolcacheArchitecturePath = Join-Path $NodeToolcacheVersionPath $Architecture