Studio/.forgejo/workflows/gitleaks.yml
feibisi c6b8c35abe
Some checks are pending
gitleaks 密钥泄露扫描 / gitleaks (push) Waiting to run
ci: add gitleaks secret scanning workflow
2026-02-15 22:44:09 +00:00

33 lines
1 KiB
YAML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

name: gitleaks 密钥泄露扫描
on:
push:
branches: ['*']
pull_request:
branches: ['*']
jobs:
gitleaks:
runs-on: docker
container:
image: zricethezav/gitleaks:latest
steps:
- name: Checkout
uses: https://code.forgejo.org/actions/checkout@v4
- name: Run gitleaks
run: |
# 对增量提交扫描push 事件)
if [ "$GITHUB_EVENT_NAME" = "push" ]; then
gitleaks detect --source=. --log-opts="$GITHUB_SHA~1..$GITHUB_SHA" --verbose --exit-code 1 || {
echo "::error::gitleaks 发现了潜在的密钥泄露!请检查上方输出并移除敏感信息。"
exit 1
}
else
# PR 事件扫描全量
gitleaks detect --source=. --verbose --exit-code 1 || {
echo "::error::gitleaks 发现了潜在的密钥泄露!请检查上方输出并移除敏感信息。"
exit 1
}
fi
echo "✅ gitleaks 扫描通过,未发现密钥泄露。"