Skip to content

Commit 6b91271

Browse files
authored
Create codeql-analysis.yml
1 parent b2e8761 commit 6b91271

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: "CodeQL"
2+
3+
on:
4+
push:
5+
branches: [ "master" ]
6+
pull_request:
7+
# The branches below must be a subset of the branches above
8+
branches: [ "master" ]
9+
schedule:
10+
- cron: '45 13 * * 6'
11+
12+
jobs:
13+
analyze:
14+
name: Analyze
15+
runs-on: ubuntu-latest
16+
permissions:
17+
actions: read
18+
contents: read
19+
security-events: write
20+
21+
steps:
22+
- name: Checkout repository
23+
uses: actions/checkout@v3
24+
25+
- name: Set up Python ${{ matrix.python-version }}
26+
uses: actions/setup-python@v4
27+
with:
28+
python-version: "3.10"
29+
30+
- name: Cache pip
31+
uses: actions/cache@v3
32+
with:
33+
path: ~/.cache/pip
34+
key: ${{ runner.os }}-python-${{ matrix.python-version }}-pip-${{ hashFiles('requirements*.txt') }}
35+
restore-keys: |
36+
${{ runner.os }}-python-${{ matrix.python-version }}-pip-${{ hashFiles('requirements*.txt') }}
37+
${{ runner.os }}-python-${{ matrix.python-version }}-pip-
38+
${{ runner.os }}-python
39+
${{ runner.os }}-
40+
41+
- name: Upgrade pip
42+
run: python -m pip install --upgrade pip setuptools wheel
43+
44+
- name: Install dependencies
45+
run: |
46+
pip install -I -r requirements.txt
47+
# Set the `CODEQL-PYTHON` environment variable to the Python executable
48+
# that includes the dependencies
49+
echo "CODEQL_PYTHON=$(which python)" >> $GITHUB_ENV
50+
51+
# Initializes the CodeQL tools for scanning.
52+
- name: Initialize CodeQL
53+
uses: github/codeql-action/init@v2
54+
with:
55+
languages: python
56+
# If you wish to specify custom queries, you can do so here or in a config file.
57+
# By default, queries listed here will override any specified in a config file.
58+
# Prefix the list here with "+" to use these queries and those in the config file.
59+
60+
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
61+
# queries: security-extended,security-and-quality
62+
63+
- name: Perform CodeQL Analysis
64+
uses: github/codeql-action/analyze@v2
65+
with:
66+
category: "/language:python"

0 commit comments

Comments
 (0)