Skip to content

Commit a7de372

Browse files
committed
Add CI to check golintci-lint config
1 parent d3999a6 commit a7de372

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: check golangci-lint config
2+
on:
3+
pull_request:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
check:
10+
runs-on: ubuntu-latest
11+
strategy:
12+
matrix:
13+
golangci-lint-version: ["v1", "v2"]
14+
steps:
15+
- name: Check out code into the Go module directory
16+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
17+
- name: Set TAG_NAME
18+
if: ${{ matrix.golangci-lint-version == 'v1' }}
19+
run: echo "TAG_NAME=v1.64.8" >> "$GITHUB_ENV"
20+
- name: Set TAG_NAME
21+
if: ${{ matrix.golangci-lint-version != 'v1' }}
22+
env:
23+
GH_TOKEN: ${{ secrets.github_token }}
24+
run: echo "TAG_NAME=$(gh release list --repo golangci/golangci-lint --json name,isLatest --jq '.[] | select(.isLatest) | .name')" >> "$GITHUB_ENV"
25+
- name: Install golangci-lint
26+
run: |
27+
curl -sSfL "https://raw.githubusercontent.com/golangci/golangci-lint/refs/tags/$TAG_NAME/install.sh" | sh -s -- -b "$(go env GOPATH)/bin" "$TAG_NAME"
28+
echo "$(go env GOPATH)/bin" >> "$GITHUB_PATH"
29+
- name: Validate golangci-lint config
30+
run: golangci-lint config verify --config=.github/.golangci.${{ matrix.golangci-lint-version }}.yml

0 commit comments

Comments
 (0)