-
Notifications
You must be signed in to change notification settings - Fork 0
95 lines (83 loc) · 2.71 KB
/
Copy pathcodeql.yml
File metadata and controls
95 lines (83 loc) · 2.71 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
name: codeql
on:
pull_request:
push:
branches:
- main
schedule:
- cron: "17 7 * * 1"
workflow_dispatch:
permissions:
actions: read
contents: read
concurrency:
group: codeql-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
defaults:
run:
shell: bash
jobs:
analyze:
name: codeql / go
if: ${{ github.event.repository.private == false || vars.ENABLE_CODE_SCANNING == 'true' }}
runs-on: ubuntu-24.04
timeout-minutes: 20
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Setup Go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: go.mod
cache: true
- name: Initialize CodeQL
uses: github/codeql-action/init@cdf488f595d80d6e07e03d4674febd5ab45fa938 # v4.37.9
with:
languages: go
build-mode: autobuild
- name: Analyze
id: analyze
uses: github/codeql-action/analyze@cdf488f595d80d6e07e03d4674febd5ab45fa938 # v4.37.9
with:
output: codeql-results
upload: never
upload-database: false
wait-for-processing: false
- name: Upload CodeQL SARIF artifact
if: ${{ always() && steps.analyze.outputs.sarif-output != '' }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: codeql-sarif-${{ github.sha }}
path: codeql-results/*.sarif
if-no-files-found: error
retention-days: 14
upload-sarif:
name: codeql / provider upload
if: ${{ github.event_name != 'pull_request' && (github.event.repository.private == false || vars.ENABLE_CODE_SCANNING_UPLOAD == 'true') }}
needs: analyze
runs-on: ubuntu-24.04
timeout-minutes: 10
permissions:
actions: read
contents: read
security-events: write
steps:
- name: Download CodeQL SARIF artifact
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: codeql-sarif-${{ github.sha }}
path: codeql-results
- name: Locate CodeQL SARIF
id: sarif
run: |
set -euo pipefail
sarif_file="$(find codeql-results -type f -name '*.sarif' | sort | head -n 1)"
test -n "$sarif_file"
echo "path=$sarif_file" >> "$GITHUB_OUTPUT"
- name: Upload CodeQL SARIF
uses: github/codeql-action/upload-sarif@cdf488f595d80d6e07e03d4674febd5ab45fa938 # v4.37.9
with:
sarif_file: ${{ steps.sarif.outputs.path }}
category: codeql-go