diff --git a/.github/workflows/app-runner.yml b/.github/workflows/app-runner.yml index 32a9e24..016a054 100644 --- a/.github/workflows/app-runner.yml +++ b/.github/workflows/app-runner.yml @@ -5,10 +5,16 @@ on: branches: ['main'] paths: - 'app-runner/**' + - '.github/workflows/app-runner.yml' + - '.github/workflows/test-powershell-module.yml' + - 'PSScriptAnalyzerSettings.psd1' pull_request: branches: ['main'] paths: - 'app-runner/**' + - '.github/workflows/app-runner.yml' + - '.github/workflows/test-powershell-module.yml' + - 'PSScriptAnalyzerSettings.psd1' jobs: test: diff --git a/.github/workflows/sentry-api-client.yml b/.github/workflows/sentry-api-client.yml index 53daa29..1ed9cc5 100644 --- a/.github/workflows/sentry-api-client.yml +++ b/.github/workflows/sentry-api-client.yml @@ -5,10 +5,16 @@ on: branches: ['main'] paths: - 'sentry-api-client/**' + - '.github/workflows/sentry-api-client.yml' + - '.github/workflows/test-powershell-module.yml' + - 'PSScriptAnalyzerSettings.psd1' pull_request: branches: ['main'] paths: - 'sentry-api-client/**' + - '.github/workflows/sentry-api-client.yml' + - '.github/workflows/test-powershell-module.yml' + - 'PSScriptAnalyzerSettings.psd1' jobs: test: diff --git a/.github/workflows/test-powershell-module.yml b/.github/workflows/test-powershell-module.yml index 25ddd20..e2e052b 100644 --- a/.github/workflows/test-powershell-module.yml +++ b/.github/workflows/test-powershell-module.yml @@ -32,7 +32,9 @@ on: jobs: lint: runs-on: ubuntu-latest - if: false # Flaky with: The term 'Get-Command' is not recognized as a name of a cmdlet, + permissions: + contents: read + security-events: write defaults: run: working-directory: ${{ inputs.module-path }} @@ -42,28 +44,20 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 - - run: $PSVersionTable - - - name: Show PSScriptAnalyzer versions - run: | - Get-Module PSScriptAnalyzer | Format-Table -AutoSize - Get-Command Invoke-ScriptAnalyzer | Format-Table -AutoSize + - name: Run PSScriptAnalyzer + uses: microsoft/psscriptanalyzer-action@v1.1 + with: + path: ${{ inputs.module-path }} + recurse: true + output: results.sarif + settings: ${{ inputs.settings-path }} - - name: Run PowerShell Script Analyzer - run: | - Write-Host "Running PSScriptAnalyzer on ${{ inputs.module-name }} module..." - $settingsPath = Join-Path ".." "${{ inputs.settings-path }}" - $analysisResults = Invoke-ScriptAnalyzer -Path . -Recurse -ReportSummary -Settings $settingsPath - if ($analysisResults) { - Write-Host "PSScriptAnalyzer found issues:" -ForegroundColor Yellow - $analysisResults | Format-Table -AutoSize - if ($analysisResults | Where-Object { $_.Severity -eq 'Error' }) { - Write-Error "PSScriptAnalyzer found errors. Please fix them before merging." - exit 1 - } - } else { - Write-Host "PSScriptAnalyzer passed with no issues" -ForegroundColor Green - } + - name: Upload SARIF results to GitHub Security + uses: github/codeql-action/upload-sarif@v3 + if: always() + with: + sarif_file: results.sarif + category: psscriptanalyzer unit-tests: runs-on: windows-latest