From e7c6f06ce4782b8d31410567ad7130e249bac2f0 Mon Sep 17 00:00:00 2001 From: Volodymyr Kolesnykov Date: Tue, 11 Apr 2023 07:40:39 +0300 Subject: [PATCH] ci: Add ShellCheck workflow --- .github/problem-matcher-gcc.json | 18 ++++++++++++++++++ .github/workflows/shellcheck.yml | 22 ++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 .github/problem-matcher-gcc.json create mode 100644 .github/workflows/shellcheck.yml diff --git a/.github/problem-matcher-gcc.json b/.github/problem-matcher-gcc.json new file mode 100644 index 00000000..cf58ce42 --- /dev/null +++ b/.github/problem-matcher-gcc.json @@ -0,0 +1,18 @@ +{ + "problemMatcher": [ + { + "owner": "shellcheck-gcc", + "pattern": [ + { + "regexp": "^(.+):(\\d+):(\\d+):\\s(note|warning|error):\\s(.*)\\s\\[(SC\\d+)\\]$", + "file": 1, + "line": 2, + "column": 3, + "severity": 4, + "message": 5, + "code": 6 + } + ] + } + ] +} diff --git a/.github/workflows/shellcheck.yml b/.github/workflows/shellcheck.yml new file mode 100644 index 00000000..c822fbe8 --- /dev/null +++ b/.github/workflows/shellcheck.yml @@ -0,0 +1,22 @@ +name: ShellCheck + +on: + push: + workflow_dispatch: + +permissions: + contents: read + +jobs: + shellcheck: + name: Lint with shellcheck + runs-on: ubuntu-latest + steps: + - name: Check out source code + uses: actions/checkout@v3.5.0 + + - name: Add error matcher + run: echo "::add-matcher::$(pwd)/.github/problem-matcher-gcc.json" + + - name: Run shellcheck + run: shellcheck -o all -s sh -f gcc $(find . -path ./.git -prune -o -type f -executable -print)