-
Notifications
You must be signed in to change notification settings - Fork 0
92 lines (83 loc) · 3.15 KB
/
codeql.yml
File metadata and controls
92 lines (83 loc) · 3.15 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
name: Reusable CodeQL
# Reusable CodeQL analysis workflow for homelabforge Python+React repos.
# Consumers wrap via .github/workflows/codeql.yml that calls this with
# the repo's per-repo settings (model packs, query exclusions).
on:
workflow_call:
inputs:
python-version:
type: string
default: "3.14"
bun-version-file:
type: string
default: ".bun-version"
bun-version:
type: string
default: ""
runner-os:
type: string
default: ubuntu-latest
codeql-config-file:
type: string
default: ".github/codeql/codeql-config.yml"
python-extension-pack:
# E.g. "homelabforge/tidewatch-models" — set to enable extra
# CodeQL extension packs for the python analysis.
type: string
default: ""
jobs:
analyze:
name: Analyze (${{ matrix.language }})
runs-on: ${{ inputs.runner-os }}
# build-mode: none scans source only; no language toolchain or
# dependency install runs, so these analyses finish well under an hour.
timeout-minutes: 45
permissions:
security-events: write
contents: read
actions: read
strategy:
fail-fast: false
matrix:
language: [ 'python', 'javascript' ]
include:
- language: python
build-mode: none
- language: javascript
build-mode: none
steps:
- name: Checkout repository
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
# No language setup / dependency install: CodeQL for Python and
# JavaScript uses build-mode: none, which scans source directly.
# Dependency installation has had no effect on Python results since
# CodeQL 2.16 (Jan 2024), so installing it only burned runner time.
- name: Initialize CodeQL
uses: github/codeql-action/init@87557b9c84dde89fdd9b10e88954ac2f4248e463 # v4
with:
languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }}
queries: security-extended,security-and-quality
config-file: ${{ inputs.codeql-config-file }}
source-root: ${{ matrix.language == 'python' && 'backend' || 'frontend' }}
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@87557b9c84dde89fdd9b10e88954ac2f4248e463 # v4
env:
# Inject extension packs for python only when consumer provides one.
CODEQL_ACTION_EXTRA_OPTIONS: >-
${{ matrix.language == 'python' && inputs.python-extension-pack != '' && format(
'{{"database":{{"run-queries":["--additional-packs={0}/.github/codeql","--extension-packs={1}"]}}}}',
github.workspace,
inputs.python-extension-pack
) || '{}' }}
with:
category: "/language:${{ matrix.language }}"
output: sarif-results
upload: true
- name: Upload SARIF results
if: always()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: codeql-results-${{ matrix.language }}
path: sarif-results
retention-days: 30