diff --git a/scripts/ci_notify.py b/scripts/ci_notify.py index 8d897fe3a..2f615cab7 100644 --- a/scripts/ci_notify.py +++ b/scripts/ci_notify.py @@ -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