From 737a314d86d47de0a94444f80178a87997d8cbd1 Mon Sep 17 00:00:00 2001 From: subhamkrai Date: Mon, 17 Jun 2024 15:27:15 +0530 Subject: [PATCH] ci: add github action linters this commit add github action linters like golangci, codespell, markdownlint, misspell, govulncheck. Signed-off-by: subhamkrai --- .github/workflows/lint.yaml | 78 +++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 .github/workflows/lint.yaml diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml new file mode 100644 index 00000000..44fe9b53 --- /dev/null +++ b/.github/workflows/lint.yaml @@ -0,0 +1,78 @@ +name: lint +on: + push: + tags: + - v* + branches: + - main + - release-* + pull_request: + branches: + - main + - release-* + +# cancel the in-progress workflow when PR is refreshed. +concurrency: + group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} + cancel-in-progress: true + +permissions: + contents: read + +jobs: + codespell: + name: codespell + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: codespell + uses: codespell-project/actions-codespell@master + with: + skip: .git,*.sum + ignore_words_list: + check_filenames: true + check_hidden: true + misspell: + name: misspell + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: misspell + uses: reviewdog/action-misspell@v1 + + golangci: + name: golangci-lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: actions/setup-go@v5 + with: + go-version-file: go.mod + - name: golangci-lint + uses: golangci/golangci-lint-action@v6 + with: + # Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version. + version: v1.55 + + # Optional: golangci-lint command line arguments. + args: --config=.golangci.yml + + # actions/setup-go already handles caching + skip-cache: true + + govulncheck: + name: govulncheck + runs-on: ubuntu-latest + steps: + - uses: actions/setup-go@v5 + with: + go-version-file: go.mod + check-latest: true + - name: govulncheck + uses: golang/govulncheck-action@v1