Lints inline PowerShell script steps in GitHub Actions.
GitHub Actions workflows in the .github/workflows
directory
and action.yml
files for custom actions are linted using
PSScriptAnalyzer to check for common issues and best practices.
Issues found by PSScriptAnalyzer are emitted as GitHub Actions workflow annotations.
To lint PowerShell script steps in a GitHub Actions workflow using the default rules:
steps:
- uses: actions/checkout@v4
- uses: martincostello/lint-actions-powershell@v1
steps:
- uses: actions/checkout@v4
with:
path: 'my-repo'
- uses: martincostello/lint-actions-powershell@v1
with:
annotations-title: 'lint-powershell'
powershell-yaml-version: '0.4.12'
psscriptanalyzer-version: '1.23.0'
repo-path: 'my-repo'
settings-path: 'my-repo/ScriptAnalyzerProfile.txt'
treat-warnings-as-errors: true
Name | Description | Default |
---|---|---|
annotations-title |
The optional title to use for workflow annotations. | 'PSScriptAnalyzer' |
powershell-yaml-version |
The optional version of the powershell-yaml module to install. | Latest |
psscriptanalyzer-version |
The optional version of the PSScriptAnalyzer module to install. | Latest |
repo-path |
The optional path to the repository containing the files to lint. | github.workspace |
settings-path |
An optional path to a file containing a user-defined profile containing settings for PSScriptAnalyzer. | Default settings |
treat-warnings-as-errors |
Whether to treat warnings as errors. | false |
The default PSScriptAnalyzer settings used are equivalent to:
@{
IncludeDefaultRules = $true
Severity = @("Error", "Warning")
}
None.
Any feedback or issues can be added to the issues for this project in GitHub.
The repository is hosted in GitHub: https://github.com/martincostello/lint-actions-powershell.git
This project is licensed under the Apache 2.0 license.