forked from carmanchris31/reviewdog
-
-
Notifications
You must be signed in to change notification settings - Fork 0
274 lines (244 loc) · 8.88 KB
/
reviewdog.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
name: reviewdog
on:
push:
branches:
- master
pull_request:
jobs:
reviewdog-github-check:
permissions:
checks: write
contents: read
pull-requests: write
name: reviewdog (github-check)
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v3
with:
go-version: 1.17
- uses: actions/checkout@v3
- name: Install linters
run: go install golang.org/x/lint/golint@latest
- name: Setup reviewdog
# uses: reviewdog/action-setup@v1
run: |
go install ./cmd/reviewdog
- name: Run reviewdog
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
golint ./... | reviewdog -f=golint -name=golint-github-check -reporter=github-check -level=warning
- name: Run reviewdog with sub-dir (github-check)
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cd ./_testdata/ && golint ./... | reviewdog -f=golint -name=golint-check-subdir -reporter=github-check -level=info -filter-mode=nofilter
- name: Custom rdjson test (github-check)
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cat ./_testdata/custom_rdjson.json | \
reviewdog -name="custom-rdjson" -f=rdjson -reporter=github-check -level=info
reviewdog-pr:
permissions:
checks: write
contents: read
pull-requests: write
if: github.event_name == 'pull_request'
name: reviewdog on Pull Request
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v3
with:
go-version: 1.17
- uses: actions/checkout@v3
# https://github.com/actions/cache/blob/master/examples.md#go---modules
- name: Cache Go Modules
id: cache
uses: actions/cache@v3
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Download Go Modules
if: steps.cache.outputs.cache-hit != 'true'
run: go mod download
- name: Install linters
run: go install golang.org/x/lint/golint@latest
- name: Setup reviewdog
# uses: reviewdog/action-setup@v1
run: |
go install ./cmd/reviewdog
- name: Run reviewdog (github-pr-check)
continue-on-error: true
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
reviewdog -reporter=github-pr-check -runners=golint,govet -fail-on-error
- name: Run reviewdog (github-pr-review with tee)
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Remove Go Problem Matchers [1] as it reports duplicate results with
# reviewdog.
# [1]: https://github.com/actions/toolkit/blob/master/docs/commands.md#problem-matchers
echo "::remove-matcher owner=go::"
golint ./... | reviewdog -f=golint -name=golint-pr-review -reporter=github-pr-review -tee
- name: Run reviewdog with sub-dir (github-pr-review)
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cd ./_testdata/ && golint ./... | reviewdog -f=golint -name=golint-pr-review-subdir -reporter=github-pr-review -tee
- name: Run reviewdog with sub-dir (local+fail-on-error)
run: |
echo 'var LocalTest = 14' >> ./_testdata/golint.go
cd ./_testdata/ && golint ./... | reviewdog -f=golint -diff="git diff" -fail-on-error || EXIT_CODE=$?
git reset --hard @
test "${EXIT_CODE}" = 1
- name: Run reviewdog (github-pr-check with fail-on-error)
continue-on-error: true
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cd ./_testdata/ && golint ./... | reviewdog -f=golint -name=golint-pr-check-fail-on-error -reporter=github-pr-check -fail-on-error
- name: Run reviewdog (github-pr-check with -filter-mode=file)
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
golint | reviewdog -f=golint -name=golint-pr-check-filter-mode-file -reporter=github-pr-check -filter-mode=file -level=warning
- name: Run reviewdog (github-pr-review -filter-mode=nofilter)
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cd ./_testdata/ && golint ./... | reviewdog -f=golint -name=golint-pr-review-nofilter -reporter=github-pr-review -filter-mode=nofilter -fail-on-error || EXIT_CODE=$?
test "${EXIT_CODE}" = 1
- name: Unexpected failure (github-pr-review)
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cd ./_testdata/ && reviewdog -conf=reviewdog_error.yml \
-reporter=github-pr-review || EXIT_CODE=$?
test "${EXIT_CODE}" = 1
- name: Unexpected failure (github-check)
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cd ./_testdata/ && reviewdog -conf=reviewdog_error.yml \
-reporter=github-check || EXIT_CODE=$?
test "${EXIT_CODE}" = 1
- name: Unexpected failure (local)
run: |
cd ./_testdata/ && reviewdog -conf=reviewdog_error.yml \
-reporter=local -diff='git diff master' || EXIT_CODE=$?
test "${EXIT_CODE}" = 1
- name: Suggestion (rdjsonl)
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cat ./_testdata/suggestions.json | \
reviewdog -name="suggestion-test" -f=rdjsonl -reporter=github-pr-review
- name: Custom rdjsonl test (github-pr-review)
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cat ./_testdata/custom_rdjson.json | \
reviewdog -name="custom-rdjson" -f=rdjson -reporter=github-pr-review
- name: gofmt -s with reviewdog
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gofmt -s -d . | \
reviewdog -name="gofmt" -f=diff -f.diff.strip=0 -reporter=github-pr-review
golangci-lint:
permissions:
checks: write
contents: read
pull-requests: write
if: github.event_name == 'pull_request'
name: runner / golangci-lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: reviewdog/action-golangci-lint@v2
with:
github_token: ${{ secrets.github_token }}
golangci_lint_flags: "--enable-all --exclude-use-default=false -D wsl -D testpackage"
level: "warning"
reporter: github-pr-check
staticcheck:
permissions:
checks: write
contents: read
pull-requests: write
if: github.event_name == 'pull_request'
name: runner / staticcheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: '1.x'
- uses: reviewdog/action-staticcheck@v1
with:
github_token: ${{ secrets.github_token }}
reporter: github-pr-review
filter_mode: nofilter
fail_on_error: true
# workdir: ./_testdata/
misspell:
name: runner / misspell
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: reviewdog/action-misspell@v1
with:
github_token: ${{ secrets.github_token }}
locale: "US"
reporter: github-check
languagetool:
name: runner / languagetool
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: reviewdog/action-languagetool@v1
with:
github_token: ${{ secrets.github_token }}
reporter: github-check
level: info
patterns: |
**/*.md
!**/testdata/**
shellcheck:
if: github.event_name == 'pull_request'
name: runner / shellcheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: reviewdog/action-shellcheck@v1
with:
github_token: ${{ secrets.github_token }}
reporter: github-pr-review
alex:
name: runner / alex
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: reviewdog/action-alex@v1
with:
github_token: ${{ secrets.github_token }}
reporter: github-check
level: info
textlint:
name: runner / textlint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: reviewdog/action-setup@v1
- run: npm install
- name: textlint
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
$(npm bin)/textlint -f checkstyle README.md | \
reviewdog -f=checkstyle -name="textlint" -reporter=github-check -level=info