Merge pull request #354 from Light-Heart-Labs/docs/wall-of-heroes-update #3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Lint PowerShell | |
| on: | |
| pull_request: | |
| push: | |
| branches: | |
| - main | |
| - master | |
| jobs: | |
| powershell-lint: | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: dream-server | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install PSScriptAnalyzer | |
| shell: pwsh | |
| run: | | |
| Set-PSRepository PSGallery -InstallationPolicy Trusted | |
| Install-Module PSScriptAnalyzer -Force -Scope CurrentUser | |
| - name: Run PowerShell Script Analyzer | |
| shell: pwsh | |
| run: | | |
| $scripts = Get-ChildItem -Path installers -Filter *.ps1 -Recurse | |
| if (-not $scripts) { | |
| Write-Host "No PowerShell scripts found." | |
| exit 0 | |
| } | |
| $failed = $false | |
| foreach ($script in $scripts) { | |
| Write-Host "Analyzing $($script.FullName)" | |
| $results = Invoke-ScriptAnalyzer -Path $script.FullName -Settings ./PSScriptAnalyzerSettings.psd1 -Severity Error,Warning | |
| if ($results) { | |
| $results | Format-Table RuleName, Severity, Message, ScriptName, Line -AutoSize | |
| $failed = $true | |
| } | |
| } | |
| if ($failed) { exit 1 } |