fix: address Copilot review feedback #25
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: | |
| push: | |
| paths: | |
| - "src/**/*.ps1" | |
| - "src/**/*.psm1" | |
| - ".github/linters/PSScriptAnalyzerSettings.psd1" | |
| - ".github/workflows/lint-powershell.yml" | |
| pull_request: | |
| paths: | |
| - "src/**/*.ps1" | |
| - "src/**/*.psm1" | |
| - ".github/linters/PSScriptAnalyzerSettings.psd1" | |
| - ".github/workflows/lint-powershell.yml" | |
| workflow_dispatch: | |
| jobs: | |
| psscriptanalyzer: | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout code | |
| # gh api repos/actions/checkout/commits/v6.0.2 --jq '.sha' | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Install PSScriptAnalyzer | |
| shell: pwsh | |
| run: | | |
| # Pin to a specific version so results are reproducible | |
| # Update RequiredVersion when a new release ships on PowerShell Gallery | |
| Install-Module -Name PSScriptAnalyzer -RequiredVersion 1.25.0 -Force -Scope CurrentUser | |
| - name: Run PSScriptAnalyzer | |
| shell: pwsh | |
| run: | | |
| $settings = '.github/linters/PSScriptAnalyzerSettings.psd1' | |
| $results = Get-ChildItem -Path 'src' -Recurse -Include '*.ps1','*.psm1' | | |
| Invoke-ScriptAnalyzer -Settings $settings | |
| if ($results) { | |
| $results | Format-Table -AutoSize | |
| Write-Host "::error::PSScriptAnalyzer found $($results.Count) issue(s)." | |
| exit 1 | |
| } | |
| Write-Host "No issues found." |