tgallacher / action-sh-checker

A GitHub action that performs static analysis for shell scripts using shellcheck and shfmt

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

sh-checker

A GitHub Action that performs static analysis for shell scripts using shellcheck and shfmt

Screen Shot 2020-04-01 at 12 18 59

Usage

Job example to check all sh files but ignore the directory .terraform and file dir/example.sh

name: example
on:
  - pull_request
jobs:
  sh-checker:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v1
      - name: Run the sh-checker
        uses: luizm/action-sh-checker@v0.1.8
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          SHELLCHECK_OPTS: -e SC1004 # It is posible to exclude some shellcheck warnings.
          SHFMT_OPTS: -s # It is posible to pass arguments to shftm
        with:
          sh_checker_comment: true
          sh_checker_exclude: ".terraform ^dir/example.sh"

Environment Variables

SHELLCHECK_OPTS: Used to specify a shellcheck arguments

SHFMT_OPTS: Used to specify a shfmt argments

Inputs

sh_checker_exclude: (Optional) Directory or file name that doesn't need to be checked.

sh_checker_shfmt_disable: (Optional) If true, it will skip the shfmt. Default is false

sh_checker_shellcheck_disable: (Optional) If true, it will skip the shellcheck. Default is false

sh_checker_comment: (Optional) If true, it will show the errors as commentaries in the pull requests. Default is false

Secrets

GITHUB_TOKEN: (Optional) The GitHub API token used to post comments to pull requests. Not required if the sh_checker_comment input is set to false.

About

A GitHub action that performs static analysis for shell scripts using shellcheck and shfmt

License:MIT License


Languages

Language:Shell 79.0%Language:Dockerfile 21.0%