From 587ff5450220d1da96399eb50c451e893322a561 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=BA=81=E5=8A=A8=E7=9A=84=E6=B0=A8=E6=B0=94?= <131591012+zaodonganqi@users.noreply.github.com> Date: Tue, 14 Oct 2025 22:18:51 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96json=E9=AA=8C=E8=AF=81=20(#21?= =?UTF-8?q?44)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 优化json验证 * 优化json验证 --- .github/workflows/jsonDataValidation.yml | 46 +++++++++--------------- 1 file changed, 17 insertions(+), 29 deletions(-) diff --git a/.github/workflows/jsonDataValidation.yml b/.github/workflows/jsonDataValidation.yml index 8be8597cd..3ded25c61 100644 --- a/.github/workflows/jsonDataValidation.yml +++ b/.github/workflows/jsonDataValidation.yml @@ -337,36 +337,24 @@ jobs: : > validation_output.log VALIDATION_FAILED=false - # 检查CHANGED_FILES是否包含整个目录 - if [ "$CHANGED_FILES" = "repo/pathing" ]; then - echo "验证整个目录: repo/pathing" - set +e - python build/validate.py "repo/pathing" --fix 2>&1 | tee -a validation_output.log - PY_EXIT=$? - set -e - if [ $PY_EXIT -ne 0 ]; then - VALIDATION_FAILED=true - fi - else - # 创建一个临时文件来存储文件列表 - echo "$CHANGED_FILES" > temp_file_list.txt - # 单独验证每个修改的文件,使用while读取避免文件名中的空格和特殊字符问题 - while IFS= read -r file; do - echo "验证文件: $file" - if [ -f "$file" ]; then - set +e - python build/validate.py "$file" --fix 2>&1 | tee -a validation_output.log - PY_EXIT=$? - set -e - if [ $PY_EXIT -ne 0 ]; then - VALIDATION_FAILED=true - fi - else - echo "警告: 文件不存在 - $file" + # 验证修改的文件格式 + echo "$CHANGED_FILES" > temp_file_list.txt + # 单独验证每个修改的文件,使用while读取避免文件名中的空格和特殊字符问题 + while IFS= read -r file; do + echo "验证文件: $file" + if [ -f "$file" ]; then + set +e + python build/validate.py "$file" --fix 2>&1 | tee -a validation_output.log + PY_EXIT=$? + set -e + if [ $PY_EXIT -ne 0 ]; then + VALIDATION_FAILED=true fi - done < temp_file_list.txt - rm temp_file_list.txt - fi + else + echo "警告: 文件不存在 - $file" + fi + done < temp_file_list.txt + rm temp_file_list.txt # 检查是否有文件被修改 if [ -n "$(git status --porcelain)" ]; then