Skip to content

Commit 9fd0e65

Browse files
Merge pull request #2850 from lighting9999/patch-1
Upgrade python Workflows
2 parents 3815c24 + 7aa06eb commit 9fd0e65

File tree

2 files changed

+67
-5
lines changed

2 files changed

+67
-5
lines changed

.github/workflows/Codeql.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: "CodeQL Python Security Scan (Top-N + PR Comment)"
2+
3+
on:
4+
pull_request:
5+
branches: [ main, master ]
6+
types: [opened, synchronize, reopened]
7+
push:
8+
branches: [ main, master ]
9+
10+
permissions:
11+
contents: read
12+
actions: read
13+
security-events: write
14+
15+
jobs:
16+
codeql-analysis:
17+
name: "CodeQL Analysis (Python)"
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- name: Checkout repository
22+
uses: actions/checkout@v4
23+
with:
24+
fetch-depth: 0
25+
26+
- name: Initialize CodeQL
27+
uses: github/codeql-action/init@v3
28+
with:
29+
languages: python
30+
31+
- name: Autobuild
32+
uses: github/codeql-action/autobuild@v3
33+
34+
- name: Perform CodeQL Analysis
35+
uses: github/codeql-action/analyze@v3
36+
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 }}

.github/workflows/python.yml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,29 @@
11
name: Python Checks
22

3-
on: [pull_request, push]
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened]
6+
push:
7+
branches:
8+
- main
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
12+
cancel-in-progress: true
413

514
jobs:
615
Test:
716
runs-on: ubuntu-latest
817
steps:
918
- name: Checkout repository
10-
uses: actions/checkout@v2
19+
uses: actions/checkout@v4
1120

1221
- name: Set up Python
13-
uses: actions/setup-python@v2
22+
uses: actions/setup-python@v5
1423
with:
1524
python-version: '3.13'
1625

1726
- name: Cache Python dependencies
18-
id: cache-pip
1927
uses: actions/cache@v3
2028
with:
2129
path: ~/.cache/pip
@@ -42,4 +50,4 @@ jobs:
4250
run: mypy . --ignore-missing-imports || true
4351

4452
- name: Run Pytest tests
45-
run: pytest
53+
run: pytest

0 commit comments

Comments
 (0)