fix(ci): prevent auto-format bot from committing entire repository #1283
Reference in New Issue
Block a user
Delete Branch "fix/auto-format-shallow-clone"
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?
问题
CI 自动格式化 bot 偶尔会把整个仓库的文件加入 auto-format commit,原因是浅克隆 +
git add -A的组合问题。根因
scripts/ci/auto_fix_formatting.py的执行流程:.git目录)git init+git fetch --depth=1浅克隆git add -A(第335行)会把所有文件包括未追踪文件全部加入 commit修复
两处修改,都在
scripts/ci/auto_fix_formatting.py:git add之前加git clean -fd,清除未追踪文件git add -A改为git add -u,只 stage 已追踪文件的修改影响
git clean -fd:删除未追踪的文件和目录git add -u:只 stage 已追踪文件的修改、删除、重命名,不会添加新文件🚀 预览环境已部署
【阻塞级判定】
📊 审查概览
🔴 阻塞级问题(必须修复)
无
💡 改进建议(不阻塞合并)
无
✅ 良好实践
🤖 由 AI 代码审查机器人自动生成 | 2026-08-07 13:15:05 | 模型:
CI全绿,自动审批通过。
CI全绿,自动审批通过。
🗑️ 预览环境已清理
PR #1283 已关闭或合并,对应的预览环境已被清理。