fix(ci): 飞书通知标题增加关键词(CI通知/CI告警),解决Key Words Not Found
CI/CD Pipeline / Integration Tests (push) Has been cancelled
CI/CD Pipeline / Build Staging API Image (push) Has been cancelled
CI/CD Pipeline / Build Staging Worker Image (push) Has been cancelled
CI/CD Pipeline / Build Staging Web Image (push) Has been cancelled
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (push) Has been cancelled
CI/CD Pipeline / Staging E2E Tests (push) Has been cancelled
CI/CD Pipeline / Staging API Integration Tests (push) Has been cancelled
CI/CD Pipeline / Production Browser E2E (push) Failing after 1531h42m30s
CI/CD Pipeline / Build Production Worker Image (push) Failing after 1531h42m30s
CI/CD Pipeline / Build Production API Image (push) Failing after 1531h42m30s
CI/CD Pipeline / Deploy Production (push) Failing after 1531h42m30s
CI/CD Pipeline / Validate Code Quality And Tests (push) Has been skipped
CI/CD Pipeline / Unit Tests (push) Has been skipped
CI/CD Pipeline / Frontend Lint (push) Has been skipped
CI/CD Pipeline / Build Production Web Image (push) Failing after 1532h14m9s
CI/CD Pipeline / Integration Tests (push) Has been cancelled
CI/CD Pipeline / Build Staging API Image (push) Has been cancelled
CI/CD Pipeline / Build Staging Worker Image (push) Has been cancelled
CI/CD Pipeline / Build Staging Web Image (push) Has been cancelled
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (push) Has been cancelled
CI/CD Pipeline / Staging E2E Tests (push) Has been cancelled
CI/CD Pipeline / Staging API Integration Tests (push) Has been cancelled
CI/CD Pipeline / Production Browser E2E (push) Failing after 1531h42m30s
CI/CD Pipeline / Build Production Worker Image (push) Failing after 1531h42m30s
CI/CD Pipeline / Build Production API Image (push) Failing after 1531h42m30s
CI/CD Pipeline / Deploy Production (push) Failing after 1531h42m30s
CI/CD Pipeline / Validate Code Quality And Tests (push) Has been skipped
CI/CD Pipeline / Unit Tests (push) Has been skipped
CI/CD Pipeline / Frontend Lint (push) Has been skipped
CI/CD Pipeline / Build Production Web Image (push) Failing after 1532h14m9s
This commit is contained in:
@@ -75,25 +75,27 @@ def main() -> int:
|
||||
run_url = f"https://git.xiaoxiajianji.com/{repo}/actions/runs/{run_id}"
|
||||
|
||||
# 根据模式设置标题、状态、颜色
|
||||
# 注意:标题中必须包含飞书webhook配置的关键词,否则会报"Key Words Not Found"
|
||||
# 这里加入多个常用关键词(CI/通知/构建/部署/告警)提高命中率
|
||||
if mode == "start":
|
||||
title = "🔄 CI构建任务开始"
|
||||
title = f"🔄 CI通知:{job_name} 开始构建"
|
||||
status = "blue"
|
||||
button_text = "查看进度"
|
||||
button_type = "primary"
|
||||
elif mode == "success":
|
||||
title = f"✅ CI构建成功 - {job_name}"
|
||||
title = f"✅ CI通知:{job_name} 构建成功"
|
||||
status = "green"
|
||||
button_text = "查看详情"
|
||||
button_type = "primary"
|
||||
else: # failure
|
||||
title = f"❌ CI构建失败 - {job_name}"
|
||||
title = f"❌ CI告警:{job_name} 构建失败"
|
||||
status = "red"
|
||||
button_text = "查看失败日志"
|
||||
button_type = "danger"
|
||||
|
||||
# 构建卡片内容(含关键词"CI构建"以通过飞书机器人关键词校验)
|
||||
# 构建卡片内容
|
||||
content_lines = []
|
||||
content_lines.append(f"**CI构建任务**: {job_name}")
|
||||
content_lines.append(f"**任务**: {job_name}")
|
||||
|
||||
if mode != "start":
|
||||
content_lines.append(f"**耗时**: {duration}")
|
||||
@@ -169,7 +171,8 @@ def main() -> int:
|
||||
pass
|
||||
except Exception as e:
|
||||
print(f"通知发送失败: {e}", file=sys.stderr)
|
||||
return 1
|
||||
# 通知失败不阻断CI主流程,仅打印告警
|
||||
return 0
|
||||
|
||||
return 0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user