1111 branches :
1212 - master
1313
14- # Declare default permissions as read only.
14+ # Declare default permissions as read- only.
1515permissions : read-all
1616
1717jobs :
18+ GolangCI :
19+ runs-on : ubuntu-latest
20+ permissions :
21+ contents : read
22+ security-events : write
23+ steps :
24+ - name : Harden Runner
25+ uses : step-security/harden-runner@a90bcbc6539c36a85cdfeb73f7e2f433735f215b # v2.15.0
26+ with :
27+ egress-policy : audit
28+
29+ - name : Checkout
30+ uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
31+ with :
32+ fetch-depth : 1
33+
34+ - name : Run golangci-lint
35+ uses : golangci/golangci-lint-action@1e7e51e771db61008b38414a730f564565cf7c20 # v9.2.0
36+ with :
37+ version : latest
38+ args : --timeout=5m --output.sarif.path=golangci-lint-results.sarif --output.text.path=stdout
39+
40+ - name : Upload golangci-lint results to GitHub Security tab
41+ uses : github/codeql-action/upload-sarif@c793b717bc78562f491db7b0e93a3a178b099162 # v4.32.5
42+ with :
43+ sarif_file : golangci-lint-results.sarif
44+
1845 TrivyCode :
1946 runs-on : ubuntu-latest
2047 permissions :
48+ contents : read
2149 security-events : write
2250 steps :
2351 - name : Harden Runner
@@ -28,14 +56,14 @@ jobs:
2856 - name : Checkout code
2957 uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
3058
31- - name : Run Trivy vulnerability scanner in repo mode
59+ - name : Run Trivy vulnerability scanner in fs mode
3260 uses : aquasecurity/trivy-action@97e0b3872f55f89b95b2f65b3dbab56962816478 # 0.34.2
3361 with :
3462 scan-type : ' fs'
3563 ignore-unfixed : true
3664 format : ' sarif'
3765 output : ' trivy-results.sarif'
38- severity : ' CRITICAL'
66+ severity : ' CRITICAL,HIGH '
3967
4068 - name : Upload Trivy scan results to GitHub Security tab
4169 uses : github/codeql-action/upload-sarif@c793b717bc78562f491db7b0e93a3a178b099162 # v4.32.5
@@ -46,43 +74,38 @@ jobs:
4674 strategy :
4775 matrix :
4876 go-version :
49- - stable
77+ - " stable"
5078 runs-on : ubuntu-latest
5179 permissions :
80+ contents : read
5281 security-events : write
5382 steps :
5483 - name : Harden Runner
5584 uses : step-security/harden-runner@a90bcbc6539c36a85cdfeb73f7e2f433735f215b # v2.15.0
5685 with :
5786 egress-policy : audit
5887
59- - name : Checkout
60- uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
61- with :
62- fetch-depth : 1
63-
64- - name : VulnerabilityCheck
88+ - name : Vulnerability Check
6589 uses : golang/govulncheck-action@b625fbe08f3bccbe446d94fbf87fcc875a4f50ee # v1.0.4
6690 with :
67- repo-checkout : false
6891 go-version-input : ${{matrix.go-version}}
6992 output-format : sarif
7093 output-file : govulncheck-results.sarif
7194
72- - name : PrintSarif
73- id : PrintSarif
95+ - name : Print Sarif
96+ id : printSarif
7497 run : |
7598 cat govulncheck-results.sarif
7699
77- if grep "' results'" govulncheck-results.sarif
100+ if grep results govulncheck-results.sarif
78101 then
79102 echo "hasResults=true" >> $GITHUB_OUTPUT
80103 else
81104 echo "hasResults=false" >> $GITHUB_OUTPUT
82105 fi
83106
84- - name : Upload govolncheck results to GitHub Security tab
85- if : ${{ steps.PrintSarif .outputs.hasResults == 'true' }}
107+ - name : Upload govulncheck results to Security tab
108+ if : ${{ steps.printSarif .outputs.hasResults == 'true' }}
86109 uses : github/codeql-action/upload-sarif@c793b717bc78562f491db7b0e93a3a178b099162 # v4.32.5
87110 with :
88111 sarif_file : govulncheck-results.sarif
0 commit comments