-
Notifications
You must be signed in to change notification settings - Fork 2.3k
85 lines (72 loc) · 2.46 KB
/
codeql-analysis.yml
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
name: "Code Scanning - Action"
on:
push:
branches: [master, develop]
pull_request:
branches: [master, develop]
schedule:
- cron: 30 1 * * 0 # Runs every Sunday 1:30 am UTC
jobs:
CodeQL-Javascript:
runs-on: ubuntu-latest
permissions:
security-events: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: javascript
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
CodeQL-Python-dot-github:
runs-on: ubuntu-latest
permissions:
security-events: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
id: setup-python
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
if [ -f ${{ github.workspace }}/.github/scripts/requirements.txt ];
then pip install -r ${{ github.workspace }}/.github/scripts/requirements.txt;
fi
# Set the `CODEQL-PYTHON` environment variable to the Python executable
# that includes the dependencies
echo "CODEQL_PYTHON=${{ steps.setup-python.outputs.python-path }}" >> $GITHUB_ENV
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: python
setup-python-dependencies: false
source-root: .github/
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
CodeQL-Python-rest:
runs-on: ubuntu-latest
permissions:
security-events: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Find Python files outside the .github folder
id: find_files
run: |
python_files=$(find ${{ github.workspace }} -name "*.py" -type f -not -path '*/\.*' | wc -l)
echo "python_files=${python_files}" >> $GITHUB_OUTPUT
echo "$python_files Python files were found outside the .github folder."
- name: Initialize CodeQL
if: ${{ steps.find_files.outputs.python_files != '0' }}
uses: github/codeql-action/init@v2
with:
languages: python
- name: Perform CodeQL Analysis
if: ${{ steps.find_files.outputs.python_files != '0' }}
uses: github/codeql-action/analyze@v2