From acffa364b3e75824a42f3071152634a8d658e7fe Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Tue, 14 Jul 2026 20:19:01 +0800 Subject: [PATCH] =?UTF-8?q?fix(ci):=20=E9=A3=9E=E4=B9=A6=E9=80=9A=E7=9F=A5?= =?UTF-8?q?=E8=BF=94=E5=9B=9E=E9=94=99=E8=AF=AF=E7=A0=81=E6=97=B6=E4=B9=9F?= =?UTF-8?q?=E8=BF=94=E5=9B=9E0=EF=BC=8C=E5=BD=BB=E5=BA=95=E4=B8=8D?= =?UTF-8?q?=E9=98=BB=E6=96=ADCI=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/ci_notify.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/scripts/ci_notify.py b/scripts/ci_notify.py index 2f615cab7..bdc6aeb8a 100644 --- a/scripts/ci_notify.py +++ b/scripts/ci_notify.py @@ -160,20 +160,20 @@ def main() -> int: try: with urllib.request.urlopen(req, timeout=10) as resp: resp_body = resp.read().decode("utf-8") - print(f"通知已发送 ({mode})") # 飞书返回code=0表示成功 try: result = json.loads(resp_body) if result.get("code", 0) != 0: - print(f"飞书返回错误: {result.get('msg', resp_body)}", file=sys.stderr) - return 1 + print(f"通知发送告警: 飞书返回错误 - {result.get('msg', resp_body)}", file=sys.stderr) + print(f"通知已发送 ({mode}) - 飞书返回非0,但不阻断CI流程") + else: + print(f"通知已发送 ({mode})") except json.JSONDecodeError: - pass + print(f"通知已发送 ({mode})") except Exception as e: - print(f"通知发送失败: {e}", file=sys.stderr) - # 通知失败不阻断CI主流程,仅打印告警 - return 0 + print(f"通知发送告警: {e}", file=sys.stderr) + # 通知无论成功失败都不阻断CI主流程,统一返回0 return 0