1515permissions : read-all
1616
1717jobs :
18- TrivyCode :
18+ GolangCI :
1919 runs-on : ubuntu-latest
2020 permissions :
21+ contents : read
2122 security-events : write
2223 steps :
2324 - name : Harden Runner
2425 uses : step-security/harden-runner@a90bcbc6539c36a85cdfeb73f7e2f433735f215b # v2.15.0
2526 with :
2627 egress-policy : audit
2728
28- - name : Checkout code
29+ - name : Checkout
2930 uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
31+ with :
32+ fetch-depth : 1
3033
31- - name : Run Trivy vulnerability scanner in repo mode
32- uses : aquasecurity/trivy- action@97e0b3872f55f89b95b2f65b3dbab56962816478 # 0.34.2
34+ - name : Run golangci-lint
35+ uses : golangci/golangci-lint- action@1e7e51e771db61008b38414a730f564565cf7c20 # v9.2.0
3336 with :
34- scan-type : ' fs'
35- ignore-unfixed : true
36- format : ' sarif'
37- output : ' trivy-results.sarif'
38- severity : ' CRITICAL'
37+ version : latest
38+ args : --timeout=5m --output.sarif.path=golangci-lint-results.sarif --output.text.path=stdout
3939
40- - name : Upload Trivy scan results to GitHub Security tab
40+ - name : Upload golangci-lint results to GitHub Security tab
4141 uses : github/codeql-action/upload-sarif@c793b717bc78562f491db7b0e93a3a178b099162 # v4.32.5
4242 with :
43- sarif_file : ' trivy- results.sarif'
43+ sarif_file : golangci-lint- results.sarif
4444
45- GolangciLint :
45+ TrivyCode :
4646 runs-on : ubuntu-latest
4747 permissions :
48+ contents : read
4849 security-events : write
4950 steps :
5051 - name : Harden Runner
5152 uses : step-security/harden-runner@a90bcbc6539c36a85cdfeb73f7e2f433735f215b # v2.15.0
5253 with :
5354 egress-policy : audit
5455
55- - name : Checkout
56+ - name : Checkout code
5657 uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
57- with :
58- fetch-depth : 1
5958
60- - name : Run golangci-lint
61- uses : golangci/golangci-lint- action@1e7e51e771db61008b38414a730f564565cf7c20 # v9.2.0
59+ - name : Run Trivy vulnerability scanner in fs mode
60+ uses : aquasecurity/trivy- action@e368e328979b113139d6f9068e03accaed98a518 # 0.34.1
6261 with :
63- version : latest
64- args : --output.sarif.path=golangci-lint-results.sarif
62+ scan-type : ' fs'
63+ ignore-unfixed : true
64+ format : ' sarif'
65+ output : ' trivy-results.sarif'
66+ severity : ' CRITICAL,HIGH'
6567
66- - name : Upload golangci-lint results to GitHub Security tab
68+ - name : Upload Trivy scan results to GitHub Security tab
6769 uses : github/codeql-action/upload-sarif@c793b717bc78562f491db7b0e93a3a178b099162 # v4.32.5
6870 with :
69- sarif_file : golangci-lint- results.sarif
71+ sarif_file : ' trivy- results.sarif'
7072
7173 VulnerabilityCheck :
7274 strategy :
@@ -75,40 +77,34 @@ jobs:
7577 - " stable"
7678 runs-on : ubuntu-latest
7779 permissions :
80+ contents : read
7881 security-events : write
7982 steps :
8083 - name : Harden Runner
8184 uses : step-security/harden-runner@a90bcbc6539c36a85cdfeb73f7e2f433735f215b # v2.15.0
8285 with :
8386 egress-policy : audit
8487
85- - name : Checkout
86- uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
87- with :
88- fetch-depth : 1
89-
90- - name : VulnerabilityCheck
88+ - name : Vulnerability Check
9189 uses : golang/govulncheck-action@b625fbe08f3bccbe446d94fbf87fcc875a4f50ee # v1.0.4
9290 with :
93- repo-checkout : false
9491 go-version-input : ${{matrix.go-version}}
9592 output-format : sarif
9693 output-file : govulncheck-results.sarif
9794
98- - name : PrintSarif
99- id : PrintSarif
95+ - name : Print Sarif
96+ id : printSarif
10097 run : |
10198 cat govulncheck-results.sarif
102-
10399 if grep results govulncheck-results.sarif
104100 then
105101 echo "hasResults=true" >> $GITHUB_OUTPUT
106102 else
107103 echo "hasResults=false" >> $GITHUB_OUTPUT
108104 fi
109105
110- - name : Upload govulncheck results to GitHub Security tab
111- if : ${{ steps.PrintSarif .outputs.hasResults == 'true' }}
106+ - name : Upload govulncheck results to Security tab
107+ if : ${{ steps.printSarif .outputs.hasResults == 'true' }}
112108 uses : github/codeql-action/upload-sarif@c793b717bc78562f491db7b0e93a3a178b099162 # v4.32.5
113109 with :
114110 sarif_file : govulncheck-results.sarif
0 commit comments