Skip to content

Commit 676dbff

Browse files
At0mFlowAt0mFlow
authored andcommitted
Retry analyser setup in CI
1 parent 553bd86 commit 676dbff

1 file changed

Lines changed: 26 additions & 2 deletions

File tree

‎.github/workflows/test.yml‎

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,19 @@ jobs:
2424

2525
- name: Install PSScriptAnalyzer
2626
shell: pwsh
27-
run: Install-Module PSScriptAnalyzer -RequiredVersion 1.25.0 -Scope CurrentUser -Force
27+
run: |
28+
$maximumAttempts = 3
29+
for ($attempt = 1; $attempt -le $maximumAttempts; $attempt++) {
30+
try {
31+
Install-Module PSScriptAnalyzer -RequiredVersion 1.25.0 -Scope CurrentUser -Force -ErrorAction Stop
32+
break
33+
}
34+
catch {
35+
if ($attempt -eq $maximumAttempts) { throw }
36+
Write-Warning "Install attempt $attempt failed. Retrying."
37+
Start-Sleep -Seconds (10 * $attempt)
38+
}
39+
}
2840
2941
- name: Verify public repository boundary
3042
shell: pwsh
@@ -53,7 +65,19 @@ jobs:
5365

5466
- name: Install PSScriptAnalyzer
5567
shell: powershell
56-
run: Install-Module PSScriptAnalyzer -RequiredVersion 1.25.0 -Scope CurrentUser -Force
68+
run: |
69+
$maximumAttempts = 3
70+
for ($attempt = 1; $attempt -le $maximumAttempts; $attempt++) {
71+
try {
72+
Install-Module PSScriptAnalyzer -RequiredVersion 1.25.0 -Scope CurrentUser -Force -ErrorAction Stop
73+
break
74+
}
75+
catch {
76+
if ($attempt -eq $maximumAttempts) { throw }
77+
Write-Warning "Install attempt $attempt failed. Retrying."
78+
Start-Sleep -Seconds (10 * $attempt)
79+
}
80+
}
5781
5882
- name: Verify public repository boundary
5983
shell: powershell

0 commit comments

Comments
 (0)