fix(ci): 生产部署加门禁 - 仅 main 分支触发 build/deploy production #1649
Reference in New Issue
Block a user
Delete Branch "fix/production-deploy-gate"
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-pipeline.yml 中 build-production 和 deploy-production 没有限制只在 main 分支运行,导致 develop 合并后也会自动构建生产镜像并部署到生产环境,完全绕过了人工确认环节。
修复
build-production: 添加github.ref_name == 'main'限制,仅 main push 时构建生产镜像deploy-production: 恢复被删除的 if 条件,限制为github.event_name == 'push' && github.ref_name == 'main'影响
🚀 预览环境已部署
【阻塞级判定】
📊 审查概览
🔴 阻塞级问题(必须修复)
无
💡 改进建议(不阻塞合并)
无
✅ 良好实践
github.ref_name == 'main'判断,确保生产环境的构建和部署任务仅在主分支触发,有效防止了非主分支的误操作部署。!failure() && !cancelled()检查(虽然needs已包含依赖关系,但显式声明增加了逻辑的健壮性和可读性)。✅ 格式检查通过 | ✅ 逻辑审查通过 | ✅ 性能良好
🤖 由 AI 代码审查机器人自动生成 | 2026-09-03 08:14:50 | 模型:
🗑️ 预览环境已清理
PR #1649 已关闭或合并,对应的预览环境已被清理。