Skip to content

GitHub Action


v1.2.1 Latest version


GitHub Action to run PSScriptAnalyzer static code analysis checks on Pull Requests.

Success Criteria

This action will succeed if zero PSScriptAnalyzer errors are found. If any warnings or informational issues are found, a comment will be posted to the pull request but the action will not return a failure.


Place the following in your ./github/main.workflow file to run PSScriptAnalyzer on incoming pull requests. This action can be triggered from other GitHub events but analyzer results will only be posted as comments to pull requests.

Make sure secrets = ["GITHUB_TOKEN"] is present as it is required to post a comment back to the pull request.

workflow "psscriptanalysis" {
  on       = "pull_request"
  resolves = "PSScriptAnalyzer"

action "PSScriptAnalyzer" {
    # Replace <latest tag> with the latest tag from
    uses = "devblackops/github-action-psscriptanalyzer@<latest tag>"

    secrets = ["GITHUB_TOKEN"]

    # Optional environment variables to control analysis behavior
    env = {
        PSSCRIPTANALYZER_ROOT          = "./MyModule"
        PSSCRIPTANALYZER_SETTINGS_PATH = "./settings.psd1

Environment Variables

Name Default Description
PSSCRIPTANALYZER_ROOT . The root directory to run PSScriptAnalyzer on. By default, this is the root of the repository.
PSSCRIPTANALYZER_SETTINGS_PATH none The path to a PSScriptAnalyser settings file to control rules to execute.
PSSCRIPTANALYZER_SEND_COMMENT true Enable/disable sending comments with PSScriptAnalyzer results back to PR.


You can’t perform that action at this time.