fix(ci): 安全/风格检查 pip install 加固——防缓存损坏导致 CI 失败 #1584
Reference in New Issue
Block a user
Delete Branch "fix/ci-cache-robustness"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
问题
Gitea Actions cache 返回损坏归档时(cache EOF/deserialization failed),pip install pip-audit/detect-secrets/vulture 因 hash mismatch 直接 exit 1,导致 validate-security/validate-style 整体失败。
修复
--no-cache-dir--no-binary影响
代码审查结果 - PR #1584
⚠️ 问题(1个需要修改)
pip install vulture失败时,脚本仅打印了告警信息但并未真正跳过后续执行。第28行vulture --version仍会执行并报错 "command not found"。虽然set +e不会导致脚本退出,但这会产生误导性的错误日志,违背了"skipping"的初衷。建议参照validate_security.sh中pip-audit的处理方式,增加command -v vulture的存在性检查。💡 建议(1个可选)
pip-audit --version 2>/dev/null || true没有实际意义(因为安装失败时该命令肯定不可用),且后续第90行已经做了正确的存在性检查。建议删除该行以保持逻辑清晰。✅ 格式检查通过 | ❌ 逻辑审查需修改 | ✅ 性能无明显问题
🤖 由 AI 代码审查机器人自动生成 | 2026-08-31 12:24:16 | 模型:
🚀 预览环境已部署
🗑️ 预览环境已清理
PR #1584 已关闭或合并,对应的预览环境已被清理。