From 71a573aee4b741f03b2f71854ae129954aa42002 Mon Sep 17 00:00:00 2001 From: scawful Date: Wed, 15 Oct 2025 14:36:40 -0400 Subject: [PATCH] refactor(ci): enhance download process in CI and release workflows - Updated the download logic in both ci.yml and release.yml to include error handling for Invoke-WebRequest. - Added a fallback to curl.exe for downloading packages if the initial request fails, improving reliability in package retrieval. Benefits: - Increases robustness of the CI and release workflows by ensuring successful downloads even in case of network issues. - Enhances maintainability by centralizing download logic and error handling in the workflow scripts. --- .github/workflows/ci.yml | 7 ++++++- .github/workflows/release.yml | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5bdcedc0..7c8ceb65 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -142,7 +142,12 @@ jobs: $destination = Join-Path $downloads $pkg.Name if (-not (Test-Path $destination)) { Write-Host "Downloading $($pkg.Name)" - Invoke-WebRequest -Uri $pkg.Url -OutFile $destination + try { + Invoke-WebRequest -Uri $pkg.Url -OutFile $destination -Headers @{ "Accept" = "application/octet-stream" } + } catch { + Write-Host "Invoke-WebRequest failed, retrying with curl.exe" + & curl.exe -L $pkg.Url -o $destination + } } else { Write-Host "$($pkg.Name) already present, skipping download" } diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 54abe5ef..26be251d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -216,7 +216,12 @@ jobs: $destination = Join-Path $downloads $pkg.Name if (-not (Test-Path $destination)) { Write-Host "Downloading $($pkg.Name)" - Invoke-WebRequest -Uri $pkg.Url -OutFile $destination + try { + Invoke-WebRequest -Uri $pkg.Url -OutFile $destination -Headers @{ "Accept" = "application/octet-stream" } + } catch { + Write-Host "Invoke-WebRequest failed, retrying with curl.exe" + & curl.exe -L $pkg.Url -o $destination + } } else { Write-Host "$($pkg.Name) already present, skipping download" }