-
Notifications
You must be signed in to change notification settings - Fork 2
95 lines (84 loc) · 2.89 KB
/
Copy pathcodeql.yml
File metadata and controls
95 lines (84 loc) · 2.89 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
# PCMI — CodeQL SAST (PR #3, "Security" tech-debt row).
# Second static-analysis layer on top of govulncheck (dependency-focused).
# Scans Go, Python, and TypeScript with the security-and-quality query pack.
# Findings (when SARIF upload is on): Security → Code scanning alerts.
# Triggers: push/PR to main and release/**, weekly cron, workflow_dispatch.
# paths-ignore on docs/badges keeps cron runs from re-analysing unchanged prose.
#
# SARIF upload: GitHub rejects uploads until Code scanning is enabled under
# Settings → Security → Code scanning (and GHAS where required). Without that,
# upload: always fails the whole job with HTTP 403. We default to analysing
# locally only (upload never) and opt into uploads via repo variable:
# Settings → Secrets and variables → Actions → Variables → CODEQL_UPLOAD_SARIF = true
on:
push:
branches:
- main
- release/**
paths-ignore:
- 'badges/**'
- '**/*.md'
- 'docs/**'
pull_request:
branches:
- main
- release/**
paths-ignore:
- 'badges/**'
- '**/*.md'
- 'docs/**'
schedule:
# Monday 04:23 UTC — off-peak vs typical EU/US-east release flows
- cron: '23 4 * * 1'
workflow_dispatch:
permissions:
# Required by github/codeql-action/* to upload SARIF to the Security tab.
actions: read
contents: read
security-events: write
concurrency:
group: codeql-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
analyze:
name: Analyze (${{ matrix.language }})
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
# javascript-typescript covers sdk/typescript .ts and compiled .js in one pass
language:
- go
- python
- javascript-typescript
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Set up Go
if: matrix.language == 'go'
uses: actions/setup-go@v7
with:
go-version-file: go.mod
cache: true
- name: Set up Python
if: matrix.language == 'python'
uses: actions/setup-python@v7
with:
python-version: '3.11'
- name: Initialize CodeQL
uses: github/codeql-action/init@v4
with:
languages: ${{ matrix.language }}
queries: security-and-quality
config-file: ./.github/codeql/codeql-config.yml
- name: Autobuild
uses: github/codeql-action/autobuild@v4
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v4
with:
category: /language:${{ matrix.language }}
# Upload only when explicitly enabled — avoids PR failures on repos
# where Code scanning / Advanced Security is not turned on yet.
upload: ${{ vars.CODEQL_UPLOAD_SARIF == 'true' && 'always' || 'never' }}