From 30523b4a771e3ecc766fea4c8689bf02990afb36 Mon Sep 17 00:00:00 2001 From: lofyer Date: Wed, 5 Aug 2026 19:43:26 +0800 Subject: [PATCH] =?UTF-8?q?ci:=20=E6=B3=A8=E8=A7=A3=E5=8F=AA=E4=BF=9D?= =?UTF-8?q?=E7=95=99=E5=A4=B1=E8=B4=A5=E6=9D=A1=E7=9B=AE=EF=BC=8C=E9=81=BF?= =?UTF-8?q?=E5=85=8D=E8=A2=AB=E9=80=9A=E8=BF=87=E7=94=A8=E4=BE=8B=E6=8C=A4?= =?UTF-8?q?=E6=8E=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 50b14e9..d6b163b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -49,8 +49,10 @@ jobs: shell: bash run: | npm test > /tmp/unit.log 2>&1 || { - echo "::error title=单元测试失败::$(tail -120 /tmp/unit.log \ - | sed 's/%/%25/g; s/\r//g' | awk '{printf "%s%%0A", $0}')" + # 注解有长度上限,只挑失败条目与错误细节,别把通过的用例也塞进去 + grep -E '^(✖|not ok)' /tmp/unit.log | head -20 + echo "::error title=单元测试失败::$(grep -E '^(✖|not ok)|AssertionError|actual:|expected:|operator:|^\s+at ' /tmp/unit.log \ + | head -40 | cut -c1-300 | sed 's/%/%25/g; s/\r//g' | awk '{printf "%s%%0A", $0}')" exit 1 } tail -6 /tmp/unit.log