-
Notifications
You must be signed in to change notification settings - Fork 0
29 lines (25 loc) · 891 Bytes
/
Copy pathps-analyzer.yml
File metadata and controls
29 lines (25 loc) · 891 Bytes
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
26
27
28
29
name: PSScriptAnalyzer
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
analyze:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run PSScriptAnalyzer
shell: pwsh
run: |
if (Test-Path node_modules) { Remove-Item -Recurse -Force node_modules }
$results = Invoke-ScriptAnalyzer -Path . -Recurse -ExcludeRule PSAvoidUsingWriteHost,PSAvoidUsingCmdletAliases,PSUseShouldProcessForStateChangingFunctions
$errors = $results | Where-Object Severity -eq 'Error'
$warnings = $results | Where-Object Severity -eq 'Warning'
if ($results) {
$results | Format-Table -Property RuleName, Severity, ScriptName, Line, Message -AutoSize
}
if ($errors) {
Write-Error "PSScriptAnalyzer found errors."
exit 1
}