-
Notifications
You must be signed in to change notification settings - Fork 0
79 lines (65 loc) · 2.29 KB
/
Copy pathcode-scanning.yaml
File metadata and controls
79 lines (65 loc) · 2.29 KB
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
name: Code scanning
run-name: "Scanning: ${{ github.event.pull_request.number || format('{0} #{1}', github.ref_name, github.run_number) }}"
on:
push:
branches:
- main
pull_request:
branches:
- main
permissions:
contents: read
security-events: write
jobs:
golangci-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Lint
uses: golangci/golangci-lint-action@ba0d7d2ec06a0ea1cb5fa41b2e4a3ab91d21278a # v9.3.0
with:
version: v2.12.0
args: --output.sarif.path=results.sarif
- name: Upload SARIF report
if: always()
uses: github/codeql-action/upload-sarif@db488ddef3bf6cb639b32c2e9a7c0a7ea8271d28 # v4.53.3
with:
sarif_file: results.sarif
govulncheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up Golang stable
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version: stable
cache: false
- name: Checksum
id: checksum
run: |
checksum=$(
{
sha256sum tools/go.mod tools/go.sum
find . -type f -name "*.go" -print0 | sort -z | xargs -0 sha256sum
} | sha256sum | awk '{print $1}'
)
echo "checksum=$checksum" >> "$GITHUB_OUTPUT"
- name: Cache Go module cache
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/go/pkg/mod
key: govulncheck-go-mod-${{ hashFiles('tools/go.sum') }}
- name: Cache Go build cache
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/.cache/go-build
key: govulncheck-go-build-${{ steps.checksum.outputs.checksum }}
restore-keys: |
govulncheck-go-build-
- name: Run govulncheck
run: go tool -modfile tools/go.mod govulncheck -format sarif ./... > results.sarif
- name: Upload SARIF report
if: always()
uses: github/codeql-action/upload-sarif@db488ddef3bf6cb639b32c2e9a7c0a7ea8271d28 # v4.37.8
with:
sarif_file: results.sarif