mirror of
https://github.com/chenyme/grok2api.git
synced 2026-12-05 16:02:12 +00:00
chore: Enhance GitHub Actions workflow for security and dependency audits
This commit is contained in:
1 parent
f77b9d8454
commit
d0037b4847
1 file changed
+17
-12
@@ -13,26 +13,31 @@ permissions:
|
||||
|
||||
jobs:
|
||||
gitleaks:
|
||||
name: Gitleaks Secret Scanner
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0 # 必须:获取完整历史记录,供 Gitleaks 扫描增量
|
||||
|
||||
# 核心修复:针对 PR 显式拉取 base 分支,解决 unknown revision 报错
|
||||
- name: Fetch base branch
|
||||
if: github.event_name == 'pull_request'
|
||||
with:
|
||||
repository: ${{ github.event.pull_request.head.repo.full_name }}
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
fetch-depth: 0
|
||||
- uses: actions/checkout@v4
|
||||
if: github.event_name != 'pull_request'
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- uses: gitleaks/gitleaks-action@v2
|
||||
run: git fetch origin ${{ github.base_ref }}
|
||||
|
||||
- name: Run Gitleaks
|
||||
uses: gitleaks/gitleaks-action@v2
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
pip-audit:
|
||||
name: Python Dependency Audit
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: astral-sh/setup-uv@v3
|
||||
- run: uv export --frozen --no-dev --format requirements-txt -o /tmp/req.txt
|
||||
- run: uvx pip-audit -r /tmp/req.txt --progress-spinner off
|
||||
- name: Install uv
|
||||
uses: astral-sh/setup-uv@v3
|
||||
- name: Export requirements
|
||||
run: uv export --frozen --no-dev --format requirements-txt -o /tmp/req.txt
|
||||
- name: Run pip-audit
|
||||
run: uvx pip-audit -r /tmp/req.txt --progress-spinner off
|
||||
Reference in new issue
Block a user