forked from IBM/mcp-context-forge
-
Notifications
You must be signed in to change notification settings - Fork 0
101 lines (90 loc) · 3.48 KB
/
codeql.yml
File metadata and controls
101 lines (90 loc) · 3.48 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
96
97
98
99
100
101
# ===============================================================
# 🔍 CodeQL Advanced - Multi-Language Static Analysis Workflow
# ===============================================================
#
# This workflow:
# - Scans JavaScript/TypeScript, Python, and GitHub Actions workflows
# - Detects security vulnerabilities and code quality issues
# - Uploads SARIF results to the "Code scanning" tab in GitHub Security
# - Caches databases and dependencies to speed up analysis
# - Runs on every push/PR to `main` and weekly (Wednesday @ 21:15 UTC)
# - Excludes specified directories and suppresses selected queries
# ---------------------------------------------------------------
name: CodeQL Advanced
on:
push:
branches: ["main"]
paths-ignore:
- "**/tests/**"
- "**/docs/**"
pull_request:
branches: ["main"]
paths-ignore:
- "**/tests/**"
- "**/docs/**"
# schedule:
# - cron: '15 21 * * 3' # Weekly on Wednesday at 21:15 UTC
permissions:
contents: read # For checking out the code
security-events: write # Required to upload SARIF results
actions: read # Required in private repositories
packages: read # Required to download CodeQL packs
jobs:
analyze:
name: CodeQL (${{ matrix.language }})
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
strategy:
fail-fast: false
matrix:
include:
- language: javascript-typescript
build: none
- language: python
build: none
- language: actions
build: none
steps:
# -------------------------------------------------------------
# 0️⃣ Checkout source
# -------------------------------------------------------------
- name: ⬇️ Checkout code
uses: actions/checkout@v5
# -------------------------------------------------------------
# 1️⃣ Optional setup - runtimes for specific languages
# -------------------------------------------------------------
- name: 🐍 Setup Python
if: matrix.language == 'python'
uses: actions/setup-python@v6
with:
python-version: "3.x"
- name: 🟢 Setup Node.js
if: matrix.language == 'javascript-typescript'
uses: actions/setup-node@v5
with:
node-version: "20"
# -------------------------------------------------------------
# 2️⃣ Initialize CodeQL
# -------------------------------------------------------------
- name: 🛠️ Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
dependency-caching: true
config-file: ./.github/codeql-config.yml
# -------------------------------------------------------------
# 3️⃣ Manual build step (not needed for JS/Python/Actions)
# -------------------------------------------------------------
- if: matrix.build == 'manual'
name: ⚙️ Manual build (placeholder)
shell: bash
run: |
echo "Add manual build commands here if needed."
exit 1
# -------------------------------------------------------------
# 4️⃣ Perform CodeQL analysis
# -------------------------------------------------------------
- name: 🔬 Perform CodeQL analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{ matrix.language }}"
upload: false