Skip to content

Commit 53ca649

Browse files
fix: add CodeQL workflow with disk space cleanup
1 parent 0f00d18 commit 53ca649

File tree

2 files changed

+132
-0
lines changed

2 files changed

+132
-0
lines changed

.github/codeql/codeql-config.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: "CodeQL Config"
2+
3+
# Exclude paths to reduce disk space usage during CodeQL analysis
4+
# This prevents analyzing unnecessary files that consume disk space
5+
paths-ignore:
6+
# Dependencies - don't analyze third-party code
7+
- "**/node_modules"
8+
- "**/yarn.lock"
9+
- "**/package-lock.json"
10+
11+
# Build artifacts - generated code doesn't need analysis
12+
- "**/dist"
13+
- "**/lib"
14+
- "**/compiled"
15+
- "**/build"
16+
- "**/www"
17+
- "**/release"
18+
19+
# Test fixtures and snapshots
20+
- "**/__mocks__"
21+
- "**/__image_snapshots__"
22+
- "**/_fixtures"
23+
- "**/fixture"
24+
- "**/test/**/*.png"
25+
- "**/test/**/*.jpg"
26+
- "**/test/**/*.svg"
27+
- "**/integration-tests/**/*.png"
28+
29+
# Example and playground files - not production code
30+
- "**/example"
31+
- "**/examples"
32+
- "**/playground"
33+
- "**/website"
34+
- "**/docs"
35+
36+
# Generated files
37+
- "**/*.map"
38+
- "**/*.min.js"
39+
- "**/*.min.css"
40+
41+
# Large standalone packages - exclude website and release directories
42+
- "standalone-packages/monaco-editor/website"
43+
- "standalone-packages/monaco-editor/release"
44+
- "standalone-packages/vscode-editor/release"
45+
- "standalone-packages/vscode-textmate/**/*.result"
46+
- "standalone-packages/vscode-textmate/**/*.patch"
47+
48+
# Static assets
49+
- "**/static/fonts"
50+
- "**/static/img"
51+
- "**/public"
52+
53+
# CI/CD files
54+
- "**/Dockerfile*"
55+
- "**/.circleci"

.github/workflows/codeql.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: "CodeQL"
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
pull_request:
7+
branches: [ "main" ]
8+
schedule:
9+
- cron: '0 0 * * 0'
10+
11+
jobs:
12+
analyze:
13+
name: Analyze
14+
runs-on: ubuntu-latest
15+
permissions:
16+
actions: read
17+
contents: read
18+
security-events: write
19+
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
language: [ 'javascript' ]
24+
25+
steps:
26+
- name: Clean up disk space
27+
run: |
28+
echo "Disk space before cleanup:"
29+
df -h
30+
echo ""
31+
echo "Cleaning up unnecessary files to free disk space..."
32+
33+
# Remove large tool directories that aren't needed for JavaScript CodeQL analysis
34+
# These tools will be re-downloaded by GitHub Actions if needed for other jobs
35+
sudo rm -rf /usr/share/dotnet
36+
sudo rm -rf /opt/ghc
37+
sudo rm -rf /usr/local/share/boost
38+
sudo rm -rf /usr/local/lib/android
39+
sudo rm -rf /opt/az
40+
41+
# Remove large tool caches (CodeQL will re-download only what it needs)
42+
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
43+
44+
# Clean up system caches
45+
sudo apt-get clean
46+
sudo rm -rf /var/lib/apt/lists/*
47+
48+
# Remove Docker images if Docker is installed (not needed for CodeQL)
49+
docker system prune -af || true
50+
51+
# Remove pip cache
52+
rm -rf ~/.cache/pip || true
53+
54+
# Remove npm cache (will be recreated during checkout if needed)
55+
npm cache clean --force || true
56+
57+
echo ""
58+
echo "Disk space after cleanup:"
59+
df -h
60+
61+
- name: Checkout repository
62+
uses: actions/checkout@v4
63+
64+
- name: Initialize CodeQL
65+
uses: github/codeql-action/init@v3
66+
with:
67+
languages: ${{ matrix.language }}
68+
config-file: ./.github/codeql/codeql-config.yml
69+
70+
- name: Autobuild
71+
uses: github/codeql-action/autobuild@v3
72+
73+
- name: Perform CodeQL Analysis
74+
uses: github/codeql-action/analyze@v3
75+
with:
76+
category: "/language:${{matrix.language}}"
77+

0 commit comments

Comments
 (0)