Run PSScriptAnalyzer directly in unittests workflow

This commit is contained in:
Chris Titus
2026-07-02 11:04:39 -05:00
parent 9afd0be008
commit c807a3b76c
+16 -8
View File
@@ -9,14 +9,22 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v7 - uses: actions/checkout@v7
- name: lint - name: Install PSScriptAnalyzer
uses: devblackops/github-action-psscriptanalyzer@master run: |
with: Set-PSRepository -Name PSGallery -InstallationPolicy Trusted
sendComment: false Install-Module -Name PSScriptAnalyzer -RequiredVersion 1.20.0 -Scope CurrentUser -Force
settingsPath: lint/PSScriptAnalyser.ps1 Import-Module PSScriptAnalyzer -RequiredVersion 1.20.0 -Force
failOnErrors: false Get-Module PSScriptAnalyzer | Select-Object Name, Version, Path
failOnWarnings: false shell: pwsh
failOnInfos: false - name: Run PSScriptAnalyzer
run: |
$results = Invoke-ScriptAnalyzer -Path . -Settings ./lint/PSScriptAnalyser.ps1 -Recurse
if ($results) {
$results | Format-Table -AutoSize | Out-String -Width 4096 | Write-Host
} else {
Write-Host "PSScriptAnalyzer found no diagnostics."
}
shell: pwsh
test: test:
runs-on: windows-latest runs-on: windows-latest