From 0eaff24231420ddb6785d666bb8f8c46f611a37d Mon Sep 17 00:00:00 2001 From: Luca Comellini Date: Fri, 16 Jun 2023 11:00:13 -0700 Subject: [PATCH] Add actionlint to lint workflow Adds a job for actionlint to lint workflow files and prevent merging if they have errors --- .github/workflows/lint.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index d24cf43be1..4b02bd3e63 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -27,10 +27,12 @@ jobs: steps: - name: Checkout Repository uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 + - name: Setup Golang Environment uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1 with: go-version-file: go.mod + - name: Lint Code uses: golangci/golangci-lint-action@639cd343e1d3b897ff35927a75193d57cfcba299 # v3.6.0 with: @@ -43,10 +45,12 @@ jobs: steps: - name: Checkout Repository uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 + - name: Get Prettier version id: prettier-version run: | echo "version=$(jq -r .devDependencies.prettier ${{ github.workspace }}/internal/nginx/modules/package.json)" >> $GITHUB_OUTPUT + - name: Run Prettier on NJS code id: prettier-run uses: rutajdash/prettier-cli-action@9e27606a9e18d40b6b4a2b4159e780241d2fbb3c # v1.0.1 @@ -54,6 +58,7 @@ jobs: config_path: ${{ github.workspace }}/internal/nginx/modules/.prettierrc file_pattern: ${{ github.workspace }}/internal/nginx/modules/**/*.js prettier_version: ${{ steps.prettier-version.outputs.version }} + - name: Prettier Output if: failure() shell: bash @@ -61,3 +66,14 @@ jobs: echo "The following files are not formatted:" echo "${{steps.prettier-run.outputs.prettier_output}}" echo "Run \"make njs-fmt\" locally to format the code" + + actionlint: + name: Actionlint + runs-on: ubuntu-22.04 + steps: + - name: Checkout Repository + uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 + + - uses: reviewdog/action-actionlint@42de1e3a0f52d5f8b8390894de87bc603844e530 # v1.37.0 + with: + actionlint_flags: -shellcheck ""