Repository navigation
54 lines (50 loc) · 1.74 KB
/
Copy pathcodeql.yml
File metadata and controls
54 lines (50 loc) · 1.74 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
54
name: CodeQL
on:
push:
branches: [main]
pull_request:
schedule:
- cron: '23 4 * * 1'
permissions:
contents: read
jobs:
analyze:
name: Analyze (${{ matrix.language }})
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
security-events: write
actions: read
contents: read
strategy:
fail-fast: false
matrix:
language: [python, javascript-typescript]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7
with:
python-version: '3.12'
- name: Extract embedded JavaScript for CodeQL
if: matrix.language == 'javascript-typescript'
run: |
python - <<'PY'
import ast
from pathlib import Path
output = Path('codeql-sources')
output.mkdir()
for source in Path('runledger').rglob('*.py'):
tree = ast.parse(source.read_text(encoding='utf-8'))
for index, node in enumerate(ast.walk(tree)):
if isinstance(node, ast.Constant) and isinstance(node.value, str):
if '<script' in node.value and '</script>' in node.value:
name = '-'.join(source.with_suffix('').parts)
(output / f'{name}-{index}.html').write_text(node.value, encoding='utf-8')
PY
- uses: github/codeql-action/init@d2aacf54c2fbc910db8d7ec338fdb54ea48c692d # v3
with:
languages: ${{ matrix.language }}
build-mode: none
- uses: github/codeql-action/analyze@d2aacf54c2fbc910db8d7ec338fdb54ea48c692d # v3
with:
category: '/language:${{ matrix.language }}'