diff --git a/.github/workflows/windows-nightly-ci.yml b/.github/workflows/windows-nightly-ci.yml index 8ca3c540..dbc1cc12 100644 --- a/.github/workflows/windows-nightly-ci.yml +++ b/.github/workflows/windows-nightly-ci.yml @@ -25,8 +25,24 @@ jobs: shell: powershell run: | $InstallerPath = "C:\vscode-installer.exe" - Invoke-WebRequest -Uri "https://update.code.visualstudio.com/latest/win32-x64-user/stable" -OutFile $InstallerPath - Start-Process -FilePath $InstallerPath -ArgumentList "/silent" -Wait + $Uri = "https://update.code.visualstudio.com/latest/win32-x64-user/stable" + $RetryCount = 0 + $MaxRetries = 3 + $Success = $false + + while (-not $Success -and $RetryCount -lt $MaxRetries) { + try { + Invoke-WebRequest -Uri $Uri -OutFile $InstallerPath -TimeoutSec 60 + $Success = $true + } catch { + $RetryCount++ + Write-Output "Download failed. Retry $RetryCount of $MaxRetries..." + Start-Sleep -Seconds 10 + } + } + if (-not $Success) { + throw "Failed to download VSCode installer after $MaxRetries attempts." + } - name: Check VSCode installation shell: powershell