Giter Club home page Giter Club logo

github-action-psscriptanalyzer's Introduction

github-action-psscriptanalyzer

GitHub Actions Status

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

Success Criteria

By default, this action will succeed if zero PSScriptAnalyzer errors and warnings are found. Failing on errors, warnings, or informational issues can be configured. See Usage below. The sending of comments back to the PR if the action fails can be disabled if desired.

Usage

Basic

Basic configuration that will run PSSA and fail on errors or warnings, and send a comment back to the PR with a summary. Note, that repoToken is required for sending comments back.

name: CI
on: [pull_request]
jobs:
  lint:
    name: Run PSSA
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - name: lint
      uses: devblackops/github-action-psscriptanalyzer@master
      with:
        repoToken: ${{ secrets.GITHUB_TOKEN }}

Advanced

Advanced configuration that will run PSSA only in the MyModule directory, with custom PSSA settings, and fail on errors, warnings, or informational issues. A comment back to the PR with the PSSA summary will also be sent if any issues were detected.

name: CI
on: [pull_request]
jobs:
  lint:
    name: Run PSSA
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - name: lint
      uses: devblackops/github-action-psscriptanalyzer@master
      with:
        rootPath: MyModule
        settingsPath: pssa_settings.psd1
        sendComment: true
        repoToken: ${{ secrets.GITHUB_TOKEN }}
        failOnErrors: true
        failOnWarnings: true
        failOnInfos: true

Docker

Use the Docker Hub version of the Action instead of building the container during the check.

name: CI
on: [pull_request]
jobs:
  lint:
    name: Run PSSA
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - name: lint
      uses: docker://devblackops/github-action-psscriptanalyzer:2.2.0
      with:
        repoToken: ${{ secrets.GITHUB_TOKEN }}

Inputs

Name Default Description
rootPath <none> The root directory to run PSScriptAnalyzer on. By default, this is the root of the repository.
settingsPath <none> The path to a PSScriptAnalyser settings file to control rules to execute.
sendComment true Enable/disable sending comments with PSScriptAnalyzer results back to PR.
repoToken <none> GitHub token the action will use to send comments back to PR with. Use ${{ secrets.GITHUB_TOKEN }}.
failOnErrors true Enable/disable failing the action on PSScriptAnalyzer error items.
failOnWarnings true Enable/disable failing the action on PSScriptAnalyzer warning items.
failOnInfos false Enable/disable failing the action on PSScriptAnalyzer informational items.

Example

github-action-psscriptanalyzer's People

Contributors

alagoutte avatar crazycodeuk avatar devblackops avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.