-
Notifications
You must be signed in to change notification settings - Fork 1
55 lines (47 loc) · 1.61 KB
/
codeql-analysis.yml
File metadata and controls
55 lines (47 loc) · 1.61 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
name: "CodeQL Analysis"
# This workflow explicitly excludes Python analysis for this documentation repository
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
schedule:
- cron: '0 0 * * 0' # Run once a week
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
# Override automatic language detection to explicitly exclude Python
language: [ 'javascript' ] # Only include JavaScript if needed
steps:
- name: Checkout repository
uses: actions/checkout@v4
# Explicitly exclude Python files
- name: Setup Python exclusion
run: |
echo "# Language detection overrides" > .gitattributes
echo "*.py linguist-generated=true" >> .gitattributes
echo "*.md linguist-detectable=true" >> .gitattributes
echo "*.html linguist-detectable=true" >> .gitattributes
git add .gitattributes
git config --global user.name "GitHub Actions"
git config --global user.email "actions@github.com"
git commit -m "Add gitattributes to help language detection" || echo "No changes to commit"
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
config-file: ./.github/codeql/codeql-config.yml
# Skip Python extraction
tools: '!python'
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{ matrix.language }}"