2
2
# 🔍 CodeQL Advanced – Multi-Language Static Analysis Workflow
3
3
# ===============================================================
4
4
#
5
- # This workflow:
6
- # • Scans JavaScript/TypeScript, Python, and GitHub Actions workflows
7
- # • Detects security vulnerabilities & code-quality issues with CodeQL
8
- # • Uploads SARIF results to the “Code scanning” tab
9
- # • Caches databases & dependencies to speed up re-runs
10
- # • Runs on every push/PR to `main` and weekly (Wed 21:15 UTC)
5
+ # Scans JavaScript/TypeScript, Python, and GitHub Actions workflows.
6
+ # Skips files in tests/, docs/, scripts/dev/ (see the config file).
11
7
# ---------------------------------------------------------------
12
8
13
9
name : CodeQL Advanced
14
10
15
11
on :
16
12
push :
17
13
branches : [ "main" ]
14
+ paths-ignore :
15
+ - ' **/tests/**'
16
+ - ' **/docs/**'
18
17
pull_request :
19
18
branches : [ "main" ]
19
+ paths-ignore :
20
+ - ' **/tests/**'
21
+ - ' **/docs/**'
20
22
schedule :
21
23
- cron : ' 15 21 * * 3' # Wednesday @ 21:15 UTC
22
24
23
- # -----------------------------------------------------------------
24
- # Minimal permissions – principle of least privilege
25
- # -----------------------------------------------------------------
26
25
permissions :
27
- contents : read # checkout
28
- security-events : write # upload SARIF
29
- actions : read # needed in private repos
30
- packages : read # download query packs
26
+ contents : read
27
+ security-events : write
28
+ actions : read
29
+ packages : read
31
30
32
31
jobs :
33
32
analyze :
@@ -46,15 +45,10 @@ jobs:
46
45
build : none
47
46
48
47
steps :
49
- # -------------------------------------------------------------
50
- # 0️⃣ Checkout source
51
- # -------------------------------------------------------------
52
- - name : ⬇️ Checkout code
48
+ - name : ⬇️ Checkout code
53
49
uses : actions/checkout@v4
54
50
55
- # -------------------------------------------------------------
56
- # 1️⃣ Optional runtimes (harmless for interpreted languages)
57
- # -------------------------------------------------------------
51
+ # Optional runtimes
58
52
- name : 🐍 Setup Python
59
53
if : matrix.language == 'python'
60
54
uses : actions/setup-python@v5
@@ -67,30 +61,22 @@ jobs:
67
61
with :
68
62
node-version : ' 20'
69
63
70
- # -------------------------------------------------------------
71
- # 2️⃣ Initialize CodeQL
72
- # -------------------------------------------------------------
64
+ # Initialize CodeQL with external config file
73
65
- name : 🛠️ Initialize CodeQL
74
66
uses : github/codeql-action/init@v3
75
67
with :
76
68
languages : ${{ matrix.language }}
77
69
dependency-caching : true
78
- # NOTE: Comma-separated list — no "+" prefix needed
79
- queries : security-extended,security-and-quality
70
+ config-file : ./.github/codeql-config.yml # ← points to the file above
80
71
81
- # -------------------------------------------------------------
82
- # 3️⃣ Manual build placeholder (not required here)
83
- # -------------------------------------------------------------
72
+ # Placeholder build step if you ever need manual builds
84
73
- if : matrix.build == 'manual'
85
- name : ⚙️ Manual build (placeholder)
74
+ name : ⚙️ Manual build
86
75
shell : bash
87
76
run : |
88
77
echo "Add build commands here for compiled languages."
89
78
exit 1
90
79
91
- # -------------------------------------------------------------
92
- # 4️⃣ Perform CodeQL analysis
93
- # -------------------------------------------------------------
94
80
- name : 🔬 Perform CodeQL analysis
95
81
uses : github/codeql-action/analyze@v3
96
82
with :
0 commit comments