From 483d95513ae4ba2a4f0f09f0678e94c541ed1236 Mon Sep 17 00:00:00 2001 From: Abhinav Gupta Date: Tue, 1 Aug 2023 11:24:31 -0700 Subject: [PATCH] ci: Use golangci-lint-action Instead of downloading and installing golangci-lint manually, use the golangci-lint-action. Besides caching Go-specific files, this also caches information computed by golangci-lint so lint checks should run faster. For this change, I've left the version of golangci-lint the same as what we were using previously. --- .github/workflows/stage-lint.yml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/stage-lint.yml b/.github/workflows/stage-lint.yml index a8fcd152..c4d43d79 100644 --- a/.github/workflows/stage-lint.yml +++ b/.github/workflows/stage-lint.yml @@ -7,10 +7,10 @@ permissions: read-all env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GOLANGCI_LINT_VERSION: v1.49 jobs: lint: - container: golangci/golangci-lint:latest runs-on: ubuntu-latest steps: - name: Checkout Repo @@ -19,6 +19,8 @@ jobs: uses: actions/setup-go@v4 with: go-version: 1.20.x + # golangci-lint-action handles all the caching for Go. + cache: false - run: go mod tidy -go=1.19 - name: Fail if god mod not tidy run: | @@ -26,10 +28,11 @@ jobs: echo "::error go.mod not tidy" exit 1 fi - - name: Lint - run: | - curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.49.0 - make lint-golang || true + + - name: golangci-lint + uses: golangci/golangci-lint-action@v3 + with: + version: ${{ env.GOLANGCI_LINT_VERSION }} check-copyright: runs-on: ubuntu-latest