From b1870aedf7efd58af69c622cc123ddf9a47ccaf8 Mon Sep 17 00:00:00 2001 From: JustAnotherID Date: Fri, 18 Oct 2024 20:55:58 +0800 Subject: [PATCH] ci: add golangci-lint review dog --- .github/workflows/reviewdog.yml | 45 +++++++++++++++++++++++++++++ .github/workflows/test_and_lint.yml | 18 ++++-------- 2 files changed, 50 insertions(+), 13 deletions(-) create mode 100644 .github/workflows/reviewdog.yml diff --git a/.github/workflows/reviewdog.yml b/.github/workflows/reviewdog.yml new file mode 100644 index 00000000..0b1a58dc --- /dev/null +++ b/.github/workflows/reviewdog.yml @@ -0,0 +1,45 @@ +name: Test & Lint + +on: + push: + paths: + - '**.go' + - 'go.mod' + - '.github/workflows/reviewdog.yml' + pull_request_target: + paths: + - '**.go' + - 'go.mod' + - '.github/workflows/reviewdog.yml' + +jobs: + review-dog: + name: Review Dog + runs-on: ubuntu-latest + permissions: + contents: read + checks: write + pull-requests: write + steps: + - name: Code + uses: actions/checkout@v4 + - name: Install Go + uses: actions/setup-go@v5 + with: + go-version: '1.22' + cache: false + - run: go get + - run: go generate ./... + + - name: GolangCI-Lint with review-dog + uses: reviewdog/action-golangci-lint@v2 + env: + REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tool_name: 'golangci-lint' + level: 'warning' + reporter: 'github-pr-review' + golangci_lint_version: 'v1.61.0' + go_version: '1.22' + cache: false \ No newline at end of file diff --git a/.github/workflows/test_and_lint.yml b/.github/workflows/test_and_lint.yml index caf29a11..e4402e0a 100644 --- a/.github/workflows/test_and_lint.yml +++ b/.github/workflows/test_and_lint.yml @@ -1,3 +1,5 @@ +name: Test & Lint + on: push: paths: @@ -10,10 +12,9 @@ on: - 'go.mod' - '.github/workflows/test_and_lint.yml' -name: Test & Lint - jobs: test-and-lint: + name: Test & Lint runs-on: ubuntu-latest steps: - name: Code @@ -31,17 +32,8 @@ jobs: - name: GolangCI-Lint uses: golangci/golangci-lint-action@v6 - if: github.event.name == 'pull_request' - with: - version: 'v1.60' - args: '--timeout 9999s' - only-new-issues: true - skip-cache: true - - - name: GolangCI-Lint - uses: golangci/golangci-lint-action@v6 - if: github.event.name != 'pull_request' + if: github.event_name != 'pull_request' with: - version: 'v1.60' + version: 'v1.61.0' args: '--timeout 9999s' skip-cache: true