File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed
Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -138,7 +138,26 @@ jobs:
138138 uses : PSModule/Github-Script@v1
139139 with :
140140 Script : |
141- Install-PSResource -Name Markdown -Repository PSGallery -TrustRepository
141+ 'Markdown' | ForEach-Object {
142+ $name = $_
143+ Write-Output "Installing module: $name"
144+ $retryCount = 5
145+ $retryDelay = 10
146+ for ($i = 0; $i -lt $retryCount; $i++) {
147+ try {
148+ Install-PSResource -Name $name -WarningAction SilentlyContinue -TrustRepository -Repository PSGallery
149+ break
150+ } catch {
151+ Write-Warning "Installation of $name failed with error: $_"
152+ if ($i -eq $retryCount - 1) {
153+ throw
154+ }
155+ Write-Warning "Retrying in $retryDelay seconds..."
156+ Start-Sleep -Seconds $retryDelay
157+ }
158+ }
159+ Import-Module -Name $name
160+ }
142161
143162 # Build an array of objects for each job
144163 $ActionTestSrcSourceCodeExpectedOutcome = 'success'
You can’t perform that action at this time.
0 commit comments