From f8dffab19dbc9fac33350396fb284f4bf8ffe20f Mon Sep 17 00:00:00 2001 From: Yusuke Kuoka Date: Sun, 9 Oct 2022 16:53:22 +0900 Subject: [PATCH] Add workflow for validating runner scripts with shellcheck (#1853) * Add workflow for validating runner scripts with shellcheck I am about to revisit #1517, #1454, #1561, and #1560 as a part of our on-going effort to a major enhancement to the runner entrypoints being made in #1759. This change is a counterpart of #1852. #1852 enables you to easily run shellcheck locally. This enables you to automatically run shellcheck on every pull request. Currently, any shellcheck error does not result in failing the workflow job. Once we addressed all the shellcheck findings, we can flip the fail_on_error option to true and let jobs start failing on pull requests that introduce invalid or suspicious bash code. --- .github/workflows/validate-runners.yaml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/.github/workflows/validate-runners.yaml b/.github/workflows/validate-runners.yaml index b7e081ec..02410f10 100644 --- a/.github/workflows/validate-runners.yaml +++ b/.github/workflows/validate-runners.yaml @@ -13,6 +13,27 @@ permissions: contents: read jobs: + shellcheck: + name: runner / shellcheck + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - name: shellcheck + uses: reviewdog/action-shellcheck@v1 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + reporter: shellcheck + path: "./runner" + pattern: | + *.sh + *.bash + update-status + # Make this consistent with `make shellsheck` + shellcheck_flags: "--shell bash --source-path runner" + exclude: "./.git/*" + check_all_files_with_shebangs: "false" + # Set this to "true" once we addressed all the shellcheck findings + fail_on_error: "false" test-runner-entrypoint: name: Test entrypoint runs-on: ubuntu-latest