• Stars
    star
    277
  • Rank 148,875 (Top 3 %)
  • Language
    Shell
  • License
    MIT License
  • Created over 5 years ago
  • Updated 9 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

GitHub action for ShellCheck.

ShellCheck

GitHub action for ShellCheck.

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: ludeeus/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: ludeeus/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: ludeeus/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: ludeeus/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: ludeeus/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: ludeeus/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: ludeeus/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: ludeeus/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: ludeeus/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: ludeeus/action-shellcheck@master
     with:
       version: v0.9.0

More Repositories

1

integration_blueprint

Blueprint for custom_component developers.
Python
324
star
2

awesomeversion

One version package to rule them all, One version package to find them, One version package to bring them all, and in the darkness bind them.
Python
56
star
3

action-ha-config-check

Check Home Assistant Configuration
Shell
23
star
4

aiogithubapi

Asynchronous Python client for the GitHub API
Python
23
star
5

container

Custom containers for various usecases
Shell
22
star
6

googledevices

Get information from, and control various Google devices.
Python
20
star
7

pytraccar

Update and fetch device information from Traccar.
Python
15
star
8

setup-homeassistant

Setup a Home Assistant instance in your GitHub action flow.
Python
13
star
9

custom-component-store

πŸ“¦ Manage your custom_components for Home Assistant
Python
12
star
10

action-push

Push the updated workspace back to the repository.
Shell
10
star
11

dockerfile-updater

A GitHub action to handle your Dockerfile dependencies.
Python
9
star
12

alpinepkgs

Python package that give you information about packages from pkgs.alpinelinux.org
Python
7
star
13

pyhaversion

Get the latest Home Assistant version from various sources.
Python
6
star
14

action-accesscontrol

Check if the invoker has access defined access level.
Python
6
star
15

pycfdns

Update Cloudflare DNS records.
Python
4
star
16

hachanges

Easy list breaking changes for Home Assistant
TypeScript
4
star
17

home-assistant-configuration

This repository exists mostly for my own amusement, but it may contain some things that others might find useful.
4
star
18

customjson

Creates json with information for custom_updater and custom_component_store.
Python
4
star
19

ad-watchdog

Watchdog App for AppDaemon.
Python
4
star
20

pyuptimerobot

Python API wrapper for Uptime Robot
Python
3
star
21

reporeleaser

Create a new release for your repo, with a commit changelog.
Python
3
star
22

ad-address

This appends address information attributes based on the lat/long from a device tracker entity.
Python
3
star
23

addonupdater

Update dependencies in Community add-ons.
Python
3
star
24

pylaunches

A python packages to get information form upcoming space launches,
Python
2
star
25

pytautulli

A python module to get information from Tautulli
Python
2
star
26

awesome-addons-repository

My awesome add-ons repository
Dockerfile
2
star
27

pyaftership

Async Python wrapper for the AfterShip API
Python
2
star
28

action-eventdata

Display the content of the event that triggered the run.
Dockerfile
2
star
29

actions

Testground for GitHub Actions
Shell
1
star
30

furystoolbox

A collection of tools.
Python
1
star
31

pyupdate

DEPRECATED
Python
1
star
32

action-reporeleaser

Create a new release using reporeleaser.
Shell
1
star
33

theme-hacs

Sample theme repository for HACS.
1
star
34

webhook

V powered CLI Webhook notifier
V
1
star
35

ad-hacs

Sample AppDaemon app for HACS.
Python
1
star
36

pyhassbian

A python package to interact with hassbian-config.
Python
1
star
37

integration-hacs

Sample integration repository for HACS.
Python
1
star
38

sampleclient

Sample Client lib.
Python
1
star
39

hacs-actions

JavaScript
1
star
40

pyruter

A module to get information about the next departure from a stop.
Python
1
star
41

colorlog

A simple component to format log output with colors.
HTML
1
star
42

nothing

Custom integration for Home Assistant that do nothing
1
star
43

action-require-labels

This action privides a simple solution to require specific labels on pull requests. Without the need to use the GitHub API and tokens.
JavaScript
1
star