|
6 | 6 | pull_request: |
7 | 7 | branches: [master, develop] |
8 | 8 | schedule: |
9 | | - # ┌───────────── minute (0 - 59) |
10 | | - # │ ┌───────────── hour (0 - 23) |
11 | | - # │ │ ┌───────────── day of the month (1 - 31) |
12 | | - # │ │ │ ┌───────────── month (1 - 12 or JAN-DEC) |
13 | | - # │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT) |
14 | | - # │ │ │ │ │ |
15 | | - # │ │ │ │ │ |
16 | | - # │ │ │ │ │ |
17 | | - # * * * * * |
18 | | - - cron: '30 1 * * 0' |
| 9 | + - cron: 30 1 * * 0 # Runs every Sunday 1:30 am UTC |
19 | 10 |
|
20 | 11 | jobs: |
21 | | - CodeQL-Build: |
22 | | - # CodeQL runs on ubuntu-latest, windows-latest, and macos-latest |
| 12 | + CodeQL-Javascript: |
23 | 13 | runs-on: ubuntu-latest |
24 | | - |
25 | 14 | permissions: |
26 | | - # required for all workflows |
27 | 15 | security-events: write |
| 16 | + steps: |
| 17 | + - name: Checkout repository |
| 18 | + uses: actions/checkout@v3 |
| 19 | + |
| 20 | + - name: Initialize CodeQL |
| 21 | + uses: github/codeql-action/init@v2 |
| 22 | + with: |
| 23 | + languages: javascript |
28 | 24 |
|
29 | | - # only required for workflows in private repositories |
30 | | - actions: read |
31 | | - contents: read |
| 25 | + - name: Perform CodeQL Analysis |
| 26 | + uses: github/codeql-action/analyze@v2 |
32 | 27 |
|
| 28 | + CodeQL-Python-dot-github: |
| 29 | + runs-on: ubuntu-latest |
| 30 | + permissions: |
| 31 | + security-events: write |
33 | 32 | steps: |
34 | 33 | - name: Checkout repository |
35 | 34 | uses: actions/checkout@v3 |
36 | 35 |
|
37 | | - # Initializes the CodeQL tools for scanning. |
| 36 | + - name: Set up Python |
| 37 | + uses: actions/setup-python@v4 |
| 38 | + id: setup-python |
| 39 | + with: |
| 40 | + python-version: '3.10' |
| 41 | + |
| 42 | + - name: Install dependencies |
| 43 | + run: | |
| 44 | + python -m pip install --upgrade pip |
| 45 | + if [ -f ${{ github.workspace }}/.github/scripts/requirements.txt ]; |
| 46 | + then pip install -r ${{ github.workspace }}/.github/scripts/requirements.txt; |
| 47 | + fi |
| 48 | + # Set the `CODEQL-PYTHON` environment variable to the Python executable |
| 49 | + # that includes the dependencies |
| 50 | + echo "CODEQL_PYTHON=${{ steps.setup-python.outputs.python-path }}" >> $GITHUB_ENV |
| 51 | +
|
38 | 52 | - name: Initialize CodeQL |
39 | 53 | uses: github/codeql-action/init@v2 |
40 | | - # Override language selection by uncommenting this and choosing your languages |
41 | 54 | with: |
42 | | - languages: javascript, python |
| 55 | + languages: python |
| 56 | + setup-python-dependencies: false |
| 57 | + source-root: .github/ |
43 | 58 |
|
44 | | - # Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java). |
45 | | - # If this step fails, then you should remove it and run the build manually (see below). |
46 | | - - name: Autobuild |
47 | | - uses: github/codeql-action/autobuild@v2 |
| 59 | + - name: Perform CodeQL Analysis |
| 60 | + uses: github/codeql-action/analyze@v2 |
48 | 61 |
|
49 | | - # ℹ️ Command-line programs to run using the OS shell. |
50 | | - # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun |
| 62 | + CodeQL-Python-rest: |
| 63 | + runs-on: ubuntu-latest |
| 64 | + permissions: |
| 65 | + security-events: write |
| 66 | + steps: |
| 67 | + - name: Checkout repository |
| 68 | + uses: actions/checkout@v3 |
51 | 69 |
|
52 | | - # ✏️ If the Autobuild fails above, remove it and uncomment the following |
53 | | - # three lines and modify them (or add more) to build your code if your |
54 | | - # project uses a compiled language |
| 70 | + - name: Find Python files outside the .github folder |
| 71 | + id: find_files |
| 72 | + run: | |
| 73 | + python_files=$(find ${{ github.workspace }} -name "*.py" -type f -not -path '*/\.*' | wc -l) |
| 74 | + echo "python_files=${python_files}" >> $GITHUB_OUTPUT |
| 75 | + echo "$python_files Python files were found outside the .github folder." |
55 | 76 |
|
56 | | - #- run: | |
57 | | - # make bootstrap |
58 | | - # make release |
| 77 | + - name: Initialize CodeQL |
| 78 | + if: ${{ steps.find_files.outputs.python_files != '0' }} |
| 79 | + uses: github/codeql-action/init@v2 |
| 80 | + with: |
| 81 | + languages: python |
59 | 82 |
|
60 | 83 | - name: Perform CodeQL Analysis |
| 84 | + if: ${{ steps.find_files.outputs.python_files != '0' }} |
61 | 85 | uses: github/codeql-action/analyze@v2 |
0 commit comments