-
Notifications
You must be signed in to change notification settings - Fork 6
53 lines (45 loc) · 1.33 KB
/
codeql.yml
File metadata and controls
53 lines (45 loc) · 1.33 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
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
name: "CodeQL"
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
schedule:
- cron: '30 5 * * 1'
jobs:
analyze:
name: Analyze (${{ matrix.language }})
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: [ 'python' ]
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Check for Python source files
id: check_python
run: |
if find . -type f -name "*.py" -not -path "./.git/*" | grep -q .; then
echo "has_python=true" >> "$GITHUB_OUTPUT"
else
echo "has_python=false" >> "$GITHUB_OUTPUT"
echo "::notice::No Python files in this branch — skipping CodeQL Python analysis."
fi
- name: Initialize CodeQL
if: steps.check_python.outputs.has_python == 'true'
uses: github/codeql-action/init@v4
with:
languages: ${{ matrix.language }}
config-file: ./.github/codeql/codeql-config.yml
- name: Perform CodeQL Analysis
if: steps.check_python.outputs.has_python == 'true'
uses: github/codeql-action/analyze@v4
with:
category: "/language:${{ matrix.language }}"