-
Notifications
You must be signed in to change notification settings - Fork 2.8k
64 lines (52 loc) · 1.87 KB
/
codeql.yml
File metadata and controls
64 lines (52 loc) · 1.87 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
name: "CodeQL"
on:
workflow_call:
schedule:
- cron: '31 6 * * 1'
# See https://github.com/ossf/scorecard/blob/main/docs/checks.md#token-permissions
permissions: # added using https://github.com/step-security/secure-workflows
contents: read
jobs:
codeql-analyze:
# Skip merge_group to avoid duplicate runs (code already scanned on pull_request)
# See https://github.com/github/codeql-action/issues/1537
if: ${{ github.event_name != 'merge_group' }}
name: CodeQL Analyze
runs-on: ubuntu-latest
permissions:
security-events: write
actions: read
strategy:
fail-fast: false
matrix:
language: [ 'go', 'python' ]
steps:
- name: Harden Runner
uses: step-security/harden-runner@fa2e9d605c4eeb9fcad4c99c224cee0c6c7f3594 # v2.16.0
with:
egress-policy: audit
- name: Checkout repository
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
with:
submodules: true
- name: Setup Go
if: matrix.language == 'go'
uses: ./.github/actions/setup-go
with:
go-version: 1.26.x
- name: Initialize CodeQL
uses: github/codeql-action/init@38697555549f1db7851b81482ff19f1fa5c4fedc # v4.34.1
with:
languages: ${{ matrix.language }}
# Use Autobuild for Python (it works fine for interpreted languages)
- name: Autobuild (Python)
if: matrix.language == 'python'
uses: github/codeql-action/autobuild@38697555549f1db7851b81482ff19f1fa5c4fedc # v4.34.1
# Explicit build for Go - required for CodeQL to analyze compiled code
- name: Build Go code
if: matrix.language == 'go'
run: |
# Build all Go binaries to ensure CodeQL can analyze them
go build -v ./...
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@38697555549f1db7851b81482ff19f1fa5c4fedc # v4.34.1