Skip to content

Commit a6623f8

Browse files
Improve PSGallery registration in lint workflow
1 parent bbfd063 commit a6623f8

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

.github/workflows/__call-common-lint.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -372,10 +372,12 @@ jobs:
372372
run: |
373373
# PSScriptAnalyzer is already installed on GitHub runners
374374
if ($env:RUNNER_NAME -notlike 'GitHub Actions*') {
375-
Get-PSRepository -Name PSGallery | Format-List
376-
Find-Module -Name PSScriptAnalyzer -Repository PSGallery
377-
378-
Register-PSRepository -Default -InstallationPolicy Trusted
375+
$repo = Get-PSRepository -Name PSGallery -ErrorAction SilentlyContinue
376+
if (-not $repo) {
377+
Register-PSRepository -Default -InstallationPolicy Trusted
378+
} else {
379+
Set-PSRepository -Name PSGallery -InstallationPolicy Trusted
380+
}
379381
Install-Module -Name PSScriptAnalyzer -Force
380382
}
381383

0 commit comments

Comments
 (0)