From b15ead9d3bbd1277ff9d08b2ee8e3233a12e2d9c Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Sun, 9 Mar 2025 15:45:53 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=A9=B9=20[Patch]:=20Enhance=20module=20in?= =?UTF-8?q?stallation=20with=20retry=20logic=20in=20Action-Test=20workflow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/Action-Test.yml | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/.github/workflows/Action-Test.yml b/.github/workflows/Action-Test.yml index e8aefae..dbb55db 100644 --- a/.github/workflows/Action-Test.yml +++ b/.github/workflows/Action-Test.yml @@ -138,7 +138,26 @@ jobs: uses: PSModule/Github-Script@v1 with: Script: | - Install-PSResource -Name Markdown -Repository PSGallery -TrustRepository + 'Markdown' | ForEach-Object { + $name = $_ + Write-Output "Installing module: $name" + $retryCount = 5 + $retryDelay = 10 + for ($i = 0; $i -lt $retryCount; $i++) { + try { + Install-PSResource -Name $name -WarningAction SilentlyContinue -TrustRepository -Repository PSGallery + break + } catch { + Write-Warning "Installation of $name failed with error: $_" + if ($i -eq $retryCount - 1) { + throw + } + Write-Warning "Retrying in $retryDelay seconds..." + Start-Sleep -Seconds $retryDelay + } + } + Import-Module -Name $name + } # Build an array of objects for each job $ActionTestSrcSourceCodeExpectedOutcome = 'success'