Skip to content

Commit 0151b8d

Browse files
authored
Add actionlint to lint workflow (#762)
Adds a job for actionlint to lint workflow files and prevent merging if they have errors
1 parent 701114e commit 0151b8d

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

.github/workflows/lint.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,12 @@ jobs:
2727
steps:
2828
- name: Checkout Repository
2929
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
30+
3031
- name: Setup Golang Environment
3132
uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
3233
with:
3334
go-version-file: go.mod
35+
3436
- name: Lint Code
3537
uses: golangci/golangci-lint-action@639cd343e1d3b897ff35927a75193d57cfcba299 # v3.6.0
3638
with:
@@ -43,21 +45,35 @@ jobs:
4345
steps:
4446
- name: Checkout Repository
4547
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
48+
4649
- name: Get Prettier version
4750
id: prettier-version
4851
run: |
4952
echo "version=$(jq -r .devDependencies.prettier ${{ github.workspace }}/internal/nginx/modules/package.json)" >> $GITHUB_OUTPUT
53+
5054
- name: Run Prettier on NJS code
5155
id: prettier-run
5256
uses: rutajdash/prettier-cli-action@9e27606a9e18d40b6b4a2b4159e780241d2fbb3c # v1.0.1
5357
with:
5458
config_path: ${{ github.workspace }}/internal/nginx/modules/.prettierrc
5559
file_pattern: ${{ github.workspace }}/internal/nginx/modules/**/*.js
5660
prettier_version: ${{ steps.prettier-version.outputs.version }}
61+
5762
- name: Prettier Output
5863
if: failure()
5964
shell: bash
6065
run: |
6166
echo "The following files are not formatted:"
6267
echo "${{steps.prettier-run.outputs.prettier_output}}"
6368
echo "Run \"make njs-fmt\" locally to format the code"
69+
70+
actionlint:
71+
name: Actionlint
72+
runs-on: ubuntu-22.04
73+
steps:
74+
- name: Checkout Repository
75+
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
76+
77+
- uses: reviewdog/action-actionlint@42de1e3a0f52d5f8b8390894de87bc603844e530 # v1.37.0
78+
with:
79+
actionlint_flags: -shellcheck ""

0 commit comments

Comments
 (0)