Skip to content

Commit a58fa05

Browse files
committed
ci: add dependency audit workflow for vulnerability checks and go.mod verification
1 parent d603830 commit a58fa05

2 files changed

Lines changed: 67 additions & 2 deletions

File tree

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Dependency Audit
2+
3+
on:
4+
push:
5+
branches:
6+
- 'main'
7+
pull_request:
8+
branches:
9+
- 'main'
10+
schedule:
11+
# Run weekly on Monday at 06:00 UTC
12+
- cron: '0 6 * * 1'
13+
14+
jobs:
15+
govulncheck:
16+
name: Check for known vulnerabilities
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v6
20+
21+
- uses: actions/setup-go@v6
22+
with:
23+
go-version-file: './go.mod'
24+
25+
- name: Install govulncheck
26+
run: go install golang.org/x/vuln/cmd/govulncheck@latest
27+
28+
- name: Run govulncheck
29+
run: govulncheck ./...
30+
31+
go-mod-tidy:
32+
name: Verify go.mod / go.sum are tidy
33+
runs-on: ubuntu-latest
34+
steps:
35+
- uses: actions/checkout@v6
36+
37+
- uses: actions/setup-go@v6
38+
with:
39+
go-version-file: './go.mod'
40+
41+
- name: Run go mod tidy
42+
run: go mod tidy
43+
44+
- name: Check for uncommitted changes
45+
run: |
46+
if [ -n "$(git status --porcelain go.mod go.sum)" ]; then
47+
echo "::error::go.mod or go.sum are not tidy. Run 'go mod tidy' and commit the changes."
48+
git diff go.mod go.sum
49+
exit 1
50+
fi
51+

.github/workflows/go-test.yml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Test
1+
name: Test & Lint
22

33
on:
44
push:
@@ -37,4 +37,18 @@ jobs:
3737
github_token: ${{ secrets.github_token }}
3838
reporter: github-pr-review
3939
filter_mode: nofilter
40-
fail_on_error: true
40+
fail_on_error: true
41+
42+
golangci-lint:
43+
name: Run golangci-lint
44+
runs-on: ubuntu-latest
45+
steps:
46+
- uses: actions/checkout@v6
47+
48+
- uses: actions/setup-go@v6
49+
with:
50+
go-version-file: './go.mod'
51+
52+
- uses: golangci/golangci-lint-action@v7
53+
with:
54+
version: latest

0 commit comments

Comments
 (0)