Coder Social home page Coder Social logo

bwhitehead0 / action-shellcheck Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ludeeus/action-shellcheck

1.0 0.0 0.0 81 KB

GitHub action for ShellCheck with support for ARM64 Linux.

License: MIT License

Shell 79.86% C 20.14%
arm64 cicd linter multiarch

action-shellcheck's Introduction

ShellCheck

GitHub action for ShellCheck.

This is a fork of ludeeus/action-shellcheck, providing support for ARM64 Linux runners.

Example

on:
  push:
    branches:
      - master

name: "Trigger: Push action"
permissions: {}

jobs:
  shellcheck:
    name: Shellcheck
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - name: Run ShellCheck
        uses: bwhitehead0/action-shellcheck@master

ShellCheck options

You can pass any supported ShellCheck option or flag with the SHELLCHECK_OPTS env key in the job definition.

Some examples include:

  • To disable specific checks (eg: -e SC2059 -e SC2034 -e SC1090)
  • To test against different shells (eg: -s dash or -s ksh)

example:

    ...
    - name: Run ShellCheck
      uses: bwhitehead0/action-shellcheck@master
      env:
        SHELLCHECK_OPTS: -e SC2059 -e SC2034 -e SC1090

Ignore paths and names

You can use the ignore_paths and ignore_names input to disable specific directories and files. These are passed as environment variables, and should evaluate to a single space-separated string. It may be convenient to use >- for readability if you have multiple selectors.

sample structure:
sample/directory/with/files/ignoreme/test.sh
sample/directory/with/files/ignoremetoo/test.sh
sample/directory/with/files/test.sh
sample/directory/with/files/ignorable.sh

example:

    ...
    - name: Run ShellCheck
      uses: bwhitehead0/action-shellcheck@master
      with:
        ignore_paths: >-
          ignoreme
          ignoremetoo
        ignore_names: ignorable.sh

This will skip sample/directory/with/files/ignoreme/test.sh, sample/directory/with/files/ignoremetoo/test.sh and sample/directory/with/files/ignorable.sh.

You can also ignore specific files using full paths or glob patterns with ignore_paths.

example:

    ...
    - name: Run ShellCheck
      uses: bwhitehead0/action-shellcheck@master
      with:
        ignore_paths: ./sample/directory/with/files/ignorable.sh **/ignoreme/test.sh

This will skip sample/directory/with/files/ignorable.sh and sample/directory/with/files/ignoreme/test.sh.

Minimum severity of errors to consider (error, warning, info, style)

You can use the severity input to not fail until specified severity is met, for example fail only if there are errors in scripts but ignore styling, info and warnings.

example:

    ...
    - name: Run ShellCheck
      uses: bwhitehead0/action-shellcheck@master
      with:
        severity: error

Run shellcheck with all paths in a single invocation

If you run into SC1090/SC1091 errors you may need to tell shellcheck to check all files at once:

    ...
    - name: Run ShellCheck
      uses: bwhitehead0/action-shellcheck@master
      with:
        check_together: 'yes'

This can turn into a problem if you have enough script files to overwhelm the maximum argv length on your system.

Run shellcheck only in a single directory

If you have multiple directories with scripts, but only want to scan one of them, you can use the following configuration:

   ...
   - name: Run ShellCheck
     uses: bwhitehead0/action-shellcheck@master
     with:
       scandir: './scripts'

Scan for additional files

If you need to scan for unusual files, you can use the additional_files key.

   ...
   - name: Run ShellCheck
     uses: bwhitehead0/action-shellcheck@master
     with:
       additional_files: 'run finish'

Change output format

Shellcheck can print output in these formats: checkstyle, diff, gcc, json, json1, quiet, tty. See some examples here.

  • tty has multi-line log messages
  • gcc has single-line log messages
   ...
   - name: Run ShellCheck
     uses: bwhitehead0/action-shellcheck@master
     with:
       format: tty

Run a specific version of Shellcheck

If running the latest stable version of Shellcheck is not to your liking, you can specify a concrete version of Shellcheck to be used. When specifying a custom version, please use any of the released versions listed in the Shellcheck repository.

   ...
   - name: Run ShellCheck
     uses: bwhitehead0/action-shellcheck@master
     with:
       version: v0.9.0

action-shellcheck's People

Contributors

ludeeus avatar bwhitehead0 avatar dadav avatar kurahaupo avatar laughedelic avatar arkq avatar benoit-g avatar dotboris avatar quodlibetor avatar garethahealy avatar ibiqlik avatar jsoref avatar justintime50 avatar ineiti avatar bostonaholic avatar cellane avatar soraxas avatar fearphage avatar cireo avatar simeg avatar triat avatar tchia04 avatar szepeviktor avatar bi1yeu avatar cramte avatar dependabot[bot] avatar pvogt09 avatar

Stargazers

 avatar

action-shellcheck's Issues

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.