-
Notifications
You must be signed in to change notification settings - Fork 4
45 lines (43 loc) · 1.17 KB
/
lint.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
name: lint
on:
pull_request:
branches:
- main
jobs:
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
show-progress: false
- uses: actions/setup-go@v5
with:
go-version-file: go.work
cache-dependency-path: |
*.sum
**/*.sum
- uses: arduino/setup-task@v2
with:
version: 3.x
- name: Generate source files
run: task generate
- name: Fix linter errors
run: task lint:fix
- name: Lint all source code
run: task lint
- name: Check for changes
id: check-changed-files
uses: tj-actions/verify-changed-files@v20
with:
files: |
*
- name: Diff
if: steps.check-changed-files.outputs.files_changed == 'true'
run: git diff
- name: Fail if code needs linting
if: steps.check-changed-files.outputs.files_changed == 'true'
run: |
echo "Changed files: ${{ steps.check-changed-files.outputs.changed_files }}"
echo "Run task generate lint:fix to attempt to fix linter errors."
exit 1