-
Notifications
You must be signed in to change notification settings - Fork 814
48 lines (42 loc) · 1.15 KB
/
powershell-lint.yml
File metadata and controls
48 lines (42 loc) · 1.15 KB
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
name: PowerShell Lint
permissions:
contents: read
on:
pull_request:
paths:
- '**.ps1'
- '**.psm1'
- '**.psd1'
- '.github/workflows/powershell-lint.yml'
push:
branches:
- master
- dev
paths:
- '**.ps1'
- '**.psm1'
- '**.psd1'
- '.github/workflows/powershell-lint.yml'
jobs:
lint:
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install PSScriptAnalyzer
shell: pwsh
run: |
Set-PSRepository PSGallery -InstallationPolicy Trusted
Install-Module -Name PSScriptAnalyzer -Force -Scope CurrentUser
- name: Run PSScriptAnalyzer
shell: pwsh
run: |
# Exclude Write-Host warnings as they're useful for CI output
$results = Invoke-ScriptAnalyzer -Path . -Recurse -ReportSummary -ExcludeRule PSAvoidUsingWriteHost
if ($results) {
$results | Format-Table -AutoSize
Write-Error "PSScriptAnalyzer found issues"
exit 1
} else {
Write-Host "✅ No PowerShell issues found"
}