fix(ci): 修复测试项目失败时的输出处理逻辑

- 使用here document格式正确输出失败项目列表到GITHUB_OUTPUT
- 添加EOF分隔符确保多行内容正确传递
- 在失败步骤中读取并显示具体的失败项目名称
- 保持原有的退出码设置确保工作流正确失败
This commit is contained in:
GeWuYou 2026-04-18 15:08:53 +08:00
parent 1665e72115
commit 5cb5a2270b

View File

@ -188,7 +188,14 @@ jobs:
printf ' %s\n' "${failed_projects[@]}"
fi
echo "failed=$failed" >> "$GITHUB_OUTPUT"
{
echo "failed=$failed"
echo "failed_projects<<EOF"
if [ "${#failed_projects[@]}" -gt 0 ]; then
printf '%s\n' "${failed_projects[@]}"
fi
echo "EOF"
} >> "$GITHUB_OUTPUT"
- name: Generate CTRF report
run: |
@ -233,4 +240,9 @@ jobs:
- name: Fail if any test project failed
if: always() && steps.test_all_projects.outputs.failed == '1'
run: exit 1
env:
FAILED_PROJECTS: ${{ steps.test_all_projects.outputs.failed_projects }}
run: |
echo "The following test projects returned non-zero exit codes:"
printf '%s\n' "$FAILED_PROJECTS"
exit 1