Skip to content

Commit 8c5f85d

Browse files
committed
feat(ci): CodeQL workflow
- runs on push, PR, schedule - checks JS and Python when included in changes
1 parent c57b02c commit 8c5f85d

File tree

1 file changed

+67
-0
lines changed

1 file changed

+67
-0
lines changed

.github/workflows/codeql.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# https://codeql.github.com/
2+
name: CodeQL
3+
4+
on:
5+
push:
6+
paths:
7+
- "**.js"
8+
- "**.py"
9+
pull_request:
10+
branches: [main]
11+
paths:
12+
- "**.js"
13+
- "**.py"
14+
schedule:
15+
- cron: "24 9 * * 6"
16+
17+
jobs:
18+
setup:
19+
name: Set up CodeQL analysis
20+
runs-on: ubuntu-latest
21+
# Required permissions
22+
permissions:
23+
pull-requests: read
24+
outputs:
25+
# changes is a JSON array with names of all filters matching any of the changed files
26+
languages: ${{ steps.filter.outputs.changes }}
27+
steps:
28+
- uses: actions/checkout@v4
29+
- uses: dorny/paths-filter@v3
30+
id: filter
31+
with:
32+
filters: |
33+
javascript: "**.js"
34+
python: "**.py"
35+
36+
codeql:
37+
name: CodeQL Analyze
38+
runs-on: ubuntu-latest
39+
needs: setup
40+
if: ${{ needs.setup.outputs.languages != '[]' }}
41+
permissions:
42+
actions: read
43+
contents: read
44+
security-events: write
45+
46+
strategy:
47+
fail-fast: false
48+
matrix:
49+
# Parse JSON array containing names of all filters matching any of changed files
50+
# e.g. ['javascript', 'python'] if both file types had changes
51+
language: ${{ fromJSON(needs.setup.outputs.languages) }}
52+
53+
steps:
54+
- name: Checkout repository
55+
uses: actions/checkout@v4
56+
57+
- name: Initialize CodeQL
58+
uses: github/codeql-action/init@v3
59+
with:
60+
languages: ${{ matrix.language }}
61+
# https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning#specifying-configuration-details-using-the-config-input
62+
config: |
63+
paths-ignore:
64+
- tests
65+
66+
- name: Perform CodeQL Analysis
67+
uses: github/codeql-action/analyze@v3

0 commit comments

Comments
 (0)