From 0c14b1e736634e0de4a59b4e8553eb4856003c5c Mon Sep 17 00:00:00 2001 From: Leo Ochoa Date: Thu, 19 Oct 2023 17:33:01 +0200 Subject: [PATCH] Add GH action for bashhate and shellcheck --- .github/workflows/bashate_and_shellcheck.yaml | 29 +++++++++++++++++++ hack/shellcheck.sh | 2 +- 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/bashate_and_shellcheck.yaml diff --git a/.github/workflows/bashate_and_shellcheck.yaml b/.github/workflows/bashate_and_shellcheck.yaml new file mode 100644 index 0000000..5fcec19 --- /dev/null +++ b/.github/workflows/bashate_and_shellcheck.yaml @@ -0,0 +1,29 @@ +name: Lint Bash Scripts +on: + push: + branches: + - '*' + +jobs: + lint: + name: Run Bashate and ShellCheck + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Build tool + run: | + make build # Creates the ./bin directory required by shellcheck afterwards + shell: bash + + - name: Run ShellCheck + run: | + make shellcheck # Execute the shellcheck target in the Makefile + shell: bash + + - name: Run Bashate + run: | + make bashate # Execute the bashate target in the Makefile + shell: bash diff --git a/hack/shellcheck.sh b/hack/shellcheck.sh index bd51718..8f85d13 100755 --- a/hack/shellcheck.sh +++ b/hack/shellcheck.sh @@ -2,7 +2,7 @@ # Set the ShellCheck version and binary path shellcheck_version="v0.7.2" -shellcheck_binary="$(go env GOPATH)/bin/shellcheck" +shellcheck_binary="./bin/shellcheck" function cleanup {