fix(ci): 修复Frontend Lint缓存脏数据导致npm ci失败 #345
Reference in New Issue
Block a user
Delete Branch "fix/frontend-lint-cache-fix"
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?
问题
PR #341 合并后,Frontend Lint出现间歇性失败:
根因
PR #341 引入的npm缓存机制只通过
package-lock.json的hash判断是否跳过npm ci,但未验证缓存的node_modules是否完整可用:node_modules实际不完整/不干净npm ci时,遇到残留的脏目录导致rmdir失败修复
node_modules/.bin/eslint是否存在且可执行npm ci失败时自动rm -rf node_modules清理后重试一次CACHE_VALID标志位替代 if/else 结构,便于扩展校验条件影响范围
验证
CI三门禁全绿即为通过。预期Lint耗时稳定在1-2min。
CI全绿,自动审批通过。