-
Notifications
You must be signed in to change notification settings - Fork 1
25 lines (25 loc) · 1.01 KB
/
lint-public.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
name: Analyze with PSScriptAnalyzer
on: [push]
jobs:
lint-with-PSScriptAnalyzer:
name: Install and run PSScriptAnalyzer
runs-on: windows-2019
steps:
- uses: actions/checkout@v4
- name: Install and cache PowerShell modules
id: psmodulecache
uses: potatoqualitee/[email protected]
with:
modules-to-cache: PSScriptAnalyzer
shell: powershell, pwsh
- name: Lint with PSScriptAnalyzer
shell: pwsh
run: |
Invoke-ScriptAnalyzer -Path ./public/*.ps1 -Recurse -Outvariable issues -Settings ./build_scripts/PSScriptAnalyzerSettings.psd1
$errors = $issues.Where({$_.Severity -eq 'Error'})
$warnings = $issues.Where({$_.Severity -eq 'Warning'})
if ($errors) {
Write-Error "There were $($errors.Count) errors and $($warnings.Count) warnings total." -ErrorAction Stop
} else {
Write-Output "There were $($errors.Count) errors and $($warnings.Count) warnings total."
}