fix(ci): use gitea.ref instead of github.ref for tag detection #1639
Reference in New Issue
Block a user
Delete Branch "fix/ci-gitea-ref-tag"
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 act runner v0.6.1 对 tag push 和 workflow_dispatch 事件不设置
github.ref变量,导致build-production、deploy-production、production-e2e三个 job 的 if 条件startsWith(github.ref, 'refs/tags/v')永远为 false,被 skip。修复
将所有
startsWith(github.ref, ...)替换为startsWith(gitea.ref, ...)。gitea.ref已在同一 workflow 的 concurrency group 中使用(ci-pipeline-${{ gitea.ref }}),确认可用。影响范围
build-production: tag push 或 main 分支 push 时触发deploy-production: tag push 时触发production-e2e: tag push 时触发🚀 预览环境已部署
【阻塞级判定】
📊 审查概览
🔴 阻塞级问题(必须修复)
github.ref修改为gitea.ref,但后半部分仍保留了github.event_name和github.ref_name。虽然 Gitea Actions 通常模拟 GitHub 上下文,但在同一个逻辑表达式中混用gitea和github命名空间是不一致且危险的。如果 Gitea 实例的github上下文模拟不完整或在未来版本中被移除,会导致该条件判断失效,进而影响生产环境的构建或部署触发逻辑。gitea命名空间,确保逻辑一致性。修改为:if: startsWith(gitea.ref, 'refs/tags/v') || (gitea.event_name == 'push' && gitea.ref_name == 'main')💡 改进建议(不阻塞合并)
无
✅ 良好实践
deploy-production和Production Browser E2E任务中正确地将github.ref替换为gitea.ref,符合 Gitea Actions 的原生用法。🤖 由 AI 代码审查机器人自动生成 | 2026-09-03 04:45:56 | 模型:
🗑️ 预览环境已清理
PR #1639 已关闭或合并,对应的预览环境已被清理。