From f31a5ed2e638b098084a2bc3ff24d2f127f3ec8d Mon Sep 17 00:00:00 2001 From: NianBroken Date: Fri, 24 Jan 2025 19:18:52 +0800 Subject: [PATCH] =?UTF-8?q?fix(user=5Flogin):=20=E6=B7=BB=E5=8A=A0run=5Flo?= =?UTF-8?q?g=E5=92=8Clgn=5Fcode=E7=A9=BA=E5=80=BC=E6=A3=80=E6=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/user_login.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/scripts/user_login.py b/scripts/user_login.py index e01ad8c..7a35709 100644 --- a/scripts/user_login.py +++ b/scripts/user_login.py @@ -43,6 +43,14 @@ copyright_text = "Copyright © 2024 NianBroken. All rights reserved." def write_github_summary(run_log, lgn_code): + # 检查 run_log 是否为空,若为空则赋值为“未知错误” + if not run_log: + run_log = "未知错误" + + # 检查 lgn_code 是否为空,若为空则赋值为“未知代码” + if not lgn_code: + lgn_code = "未知代码" + summary_log = ( f"# 正方教务管理系统成绩推送\n" f"你因 **{run_log}** 原因而登录失败,错误代码为 **{lgn_code}**。\n" @@ -51,6 +59,7 @@ def write_github_summary(run_log, lgn_code): f"{workflow_info}\n" f"{copyright_text}" ) + # 将任意个数的换行替换为两个换行 summary_log = re.sub("\n+", "\n\n", summary_log)