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'