Skip to content

Commit ab03d34

Browse files
committed
ci: align PowerShell CI analyzer policy
1 parent 28920c0 commit ab03d34

1 file changed

Lines changed: 22 additions & 4 deletions

File tree

.github/workflows/pwsh-ci.yml

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ on:
44
push:
55
branches: [main]
66
pull_request:
7+
branches: [main]
8+
workflow_dispatch:
9+
10+
permissions:
11+
contents: read
712

813
jobs:
914
analyze:
@@ -14,16 +19,29 @@ jobs:
1419
- name: Checkout
1520
uses: actions/checkout@v6
1621

22+
- name: Check PowerShell script syntax
23+
shell: pwsh
24+
run: pwsh -NoProfile -File tools/test-powershell-syntax.ps1
25+
26+
- name: Check Markdown relative links
27+
shell: pwsh
28+
run: pwsh -NoProfile -File tools/test-markdown-links.ps1
29+
1730
- name: Install analyzer
1831
shell: pwsh
1932
run: |
20-
Install-Module PSScriptAnalyzer -Scope CurrentUser -Force
33+
Install-Module -Name PSScriptAnalyzer -Scope CurrentUser -Force
2134
2235
- name: Run PSScriptAnalyzer
2336
shell: pwsh
2437
run: |
25-
$results = Invoke-ScriptAnalyzer -Path . -Recurse -Severity Error
38+
$results = Invoke-ScriptAnalyzer -Path . -Recurse -Settings PSScriptAnalyzerSettings.psd1
2639
$results | Format-Table -AutoSize
27-
if ($results.Count -gt 0) {
28-
exit 1
40+
41+
$errors = @($results | Where-Object { $_.Severity -eq 'Error' })
42+
if ($errors.Count -gt 0) {
43+
$errors | Format-Table -AutoSize
44+
throw "PSScriptAnalyzer found error-level issues."
2945
}
46+
47+
Write-Host "PSScriptAnalyzer completed: $($results.Count) finding(s), $($errors.Count) error(s)."

0 commit comments

Comments
 (0)