I was working on a project recently that has some PowerShell scripts and I wanted to add some kind of linting for PRs, as you do. The go-to for PowerShell seems to be PSScriptAnalyzer and it's something I've already setup in VS Code. Great! The
I was working on a project recently that has some PowerShell scripts and I wanted to add some kind of linting for PRs, as you do. The go-to for PowerShell seems to be PSScriptAnalyzer and it's something I've already setup in VS Code. Great! The next step was to setup a GitHub action to run PSScriptAnalyzer on my PowerShell scripts for each PR, and fail on any errors. It turns out, this is a fairly easy thing to do since the default Ubuntu GitHub-Hosted runners already come with PowerShell and PSScriptAnalyzer installed.
This is what I have setup in my PSScriptAnalyzer.ymlworkflow file in .github/worflows/:
name: Run PSPSScriptAnalyzer on PowerShell Scripts
on:
pull_request:
jobs:
PSScriptAnalyzer:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Run PSScriptAnalyzer on PowerShell Scripts
shell: pwsh
run: |
Invoke-ScriptAnalyzer -Path ./files/ -Recurse -Severity Error -EnableExitYou invoke PSScriptAnalyzer with the Invoke-ScriptAnalyzer command and I set the following paramaters:
files so use -Path ./files/. -Recurse to analyze any scripts in subdirectories of files.-Severity Error because I just care about errors and not warnings -EnableExit to return an exit code if there are any errors.I should note at this point that there is an existing PSScriptAnalyzer GitHub action: https://github.com/microsoft/psscriptanalyzer-action
I wasn't particularly interested in SARIF output, which the PSScriptAnalyzer GitHub action produces, and since PSScriptAnalyzer is already installed and easy enough to use, using a separate action seemed like overkill for my needs.
| # | Наименование новости | Тональность | Информативность | Дата публикации |
|---|---|---|---|---|
| 1 | Validating packer templates with GitHub Actions | 0 | 14.64 | 22-03-2024 |
| 2 | PowerShell Is Still King – Start‑VIADeDupJob, Rewritten | 0 | 10.94 | 06-05-2026 |
| 3 | Incident with Actions | 0 | 8 | 05-10-2026 |
| 4 | Actions Job Delays | 0 | 9.3 | 01-10-2026 |
| 5 | Your alt text passes automated checks. That doesn’t mean it’s any good. | 0 | 9.64 | 24-08-2026 |
| 6 | SnapDrift: Free Auto Visual Regression Testing On GitHub Actions | 0 | 9.67 | 20-03-2026 |
| 7 | Ausfall bei GitHub: Actions, Pages und Abrechnung gestört | 0 | 10.4 | 05-10-2026 |
| 8 | PocketCI - CircleCI in your pocket | 0 | 8.79 | 29-09-2026 |
| 9 | Продвинутый статический анализ в TypeScript-проектах: выходим за рамки tsc и ESLint | 0 | 14.75 | 01-10-2026 |
| 10 | Copy Fix Prompt, diagnose and fix failures with any AI coding agent | 0 | 6.48 | 12-08-2026 |