build(deps): bump actions/checkout from 6.0.3 to 7.0.0 (#475) #14
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 scripts | |
| on: | |
| push: | |
| branches: | |
| - develop | |
| paths: | |
| - "**.ps1" | |
| - ".github/workflows/lint-powershell.yml" | |
| pull_request: | |
| branches: | |
| - main | |
| - develop | |
| paths: | |
| - "**.ps1" | |
| - ".github/workflows/lint-powershell.yml" | |
| permissions: | |
| contents: read | |
| jobs: | |
| psscriptanalyzer: | |
| name: PSScriptAnalyzer | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| - name: Syntax check | |
| shell: pwsh | |
| run: | | |
| $errors = $null | |
| [System.Management.Automation.Language.Parser]::ParseFile( | |
| (Resolve-Path install.ps1), [ref]$null, [ref]$errors) | Out-Null | |
| if ($errors) { | |
| $errors | ForEach-Object { Write-Error $_.Message } | |
| exit 1 | |
| } | |
| Write-Host 'Parse OK' | |
| - name: Run PSScriptAnalyzer | |
| shell: pwsh | |
| run: | | |
| Install-Module PSScriptAnalyzer -Force -Scope CurrentUser | |
| # Write-Host is intentional: the script is piped to `iex`, so console | |
| # status must not leak into the output stream that Write-Output feeds. | |
| # Surface every finding (advisory), then fail only on Error severity — | |
| # the parse check above is the hard syntax gate. | |
| Invoke-ScriptAnalyzer -Path install.ps1 -ExcludeRule PSAvoidUsingWriteHost | | |
| Format-Table -AutoSize | |
| Invoke-ScriptAnalyzer -Path install.ps1 -Severity Error ` | |
| -ExcludeRule PSAvoidUsingWriteHost -EnableExit |