1- name : " CodeQL Python Security Scan (Top-N + PR Comment) "
1+ name : " CodeQL Python Security and Quality Scan "
22
33on :
4- pull_request :
5- branches : [ main, master ]
6- types : [opened, synchronize, reopened]
74 push :
85 branches : [ main, master ]
6+ pull_request :
7+ branches : [ main, master ]
98
109permissions :
1110 contents : read
@@ -18,37 +17,26 @@ jobs:
1817 runs-on : ubuntu-latest
1918
2019 steps :
20+ # 1. 检出代码
2121 - name : Checkout repository
2222 uses : actions/checkout@v4
2323 with :
2424 fetch-depth : 0
2525
26+ # 2. 初始化 CodeQL
2627 - name : Initialize CodeQL
2728 uses : github/codeql-action/init@v3
2829 with :
2930 languages : python
31+ # 不指定 queries,Action 会默认跑安全 + 质量查询
3032
33+ # 3. 自动构建
3134 - name : Autobuild
3235 uses : github/codeql-action/autobuild@v3
3336
37+ # 4. 执行分析
3438 - name : Perform CodeQL Analysis
3539 uses : github/codeql-action/analyze@v3
3640 with :
37- upload : true
38-
39- - name : Comment CodeQL Alerts on PR
40- if : github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository
41- uses : marocchino/sticky-pull-request-comment@v2
42- with :
43- path : results.sarif
44- header : " ### :shield: CodeQL Python Security Alerts Summary"
45- layout : " group-by-file"
46- format : " markdown-table"
47- sort-severity : true
48- highlight : " Critical,High"
49- collapse : " Medium,Low"
50- max-items-per-file : 5
51- show-summary : true
52- show-file-overview : true
53- overflow-text : " +{remaining} more alerts in this file"
54- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
41+ # 不指定 queries,Action 会自动跑安全 + 质量规则
42+ upload : true
0 commit comments