Skip to content

Commit bca9c66

Browse files
committed
ci: add PowerShell script analyzer workflow
1 parent 4dc7ab7 commit bca9c66

1 file changed

Lines changed: 34 additions & 0 deletions

File tree

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: PowerShell lint
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
psscriptanalyzer:
14+
name: PSScriptAnalyzer
15+
runs-on: windows-latest
16+
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v6
20+
21+
- name: Install PSScriptAnalyzer
22+
shell: pwsh
23+
run: |
24+
Set-PSRepository -Name PSGallery -InstallationPolicy Trusted
25+
Install-Module -Name PSScriptAnalyzer -Scope CurrentUser -Force
26+
27+
- name: Run analyzer
28+
shell: pwsh
29+
run: |
30+
$results = Invoke-ScriptAnalyzer -Path . -Recurse -Severity Error,Warning
31+
$results | Format-Table -AutoSize
32+
if ($results) {
33+
throw "PSScriptAnalyzer found issues."
34+
}

0 commit comments

Comments
 (0)