Skip to content

Commit 2cb2a87

Browse files
committed
fix: use pwsh to download gh runner
1 parent f9547ae commit 2cb2a87

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

images/windows-core-2025/windows-provisioner.ps1

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,22 @@ Remove-Item C:\amazon-cloudwatch-agent.msi
3030

3131
# Install dependent tools
3232
Write-Host "Installing additional development tools"
33-
choco install git awscli -y
33+
choco install git awscli powershell-core -y
3434
refreshenv
3535

3636
Write-Host "Creating actions-runner directory for the GH Action installation"
3737
New-Item -ItemType Directory -Path C:\actions-runner ; Set-Location C:\actions-runner
3838

3939
Write-Host "Downloading the GH Action runner from ${action_runner_url}"
40-
Invoke-WebRequest -Uri ${action_runner_url} -OutFile actions-runner.zip
40+
# Direct download with WebClient to prevent forced disconnects
41+
$downloadCommand = @"
42+
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
43+
`$webClient = New-Object System.Net.WebClient
44+
`$webClient.Headers.Add('User-Agent', 'PowerShell/7.0')
45+
`$webClient.DownloadFile('${action_runner_url}', 'actions-runner.zip')
46+
`$webClient.Dispose()
47+
"@
48+
pwsh -Command $downloadCommand
4149

4250
Write-Host "Un-zip action runner"
4351
Expand-Archive -Path actions-runner.zip -DestinationPath .

0 commit comments

Comments
 (0)