From cac3f91ab7ec02bf0f9b02e1bf095ca1b366267e Mon Sep 17 00:00:00 2001 From: starmen1265 Date: Mon, 2 Mar 2026 01:10:26 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20PHP=20=E8=AF=AD?= =?UTF-8?q?=E6=B3=95=E6=A3=80=E6=9F=A5=E9=80=80=E5=87=BA=E7=A0=81=E9=97=AE?= =?UTF-8?q?=E9=A2=98=EF=BC=8C=E4=BC=98=E5=8C=96=E8=A7=A6=E5=8F=91=E6=9D=A1?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/ci.yml | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index b03ab9c..1020bbc 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -2,9 +2,9 @@ name: CI on: push: - branches: [main, develop, "**"] # 所有分支 + branches: ["**"] pull_request: - branches: [main, develop, "**"] # 所有分支 + branches: [main, develop] jobs: # 代码检查 @@ -22,7 +22,19 @@ jobs: - name: PHP 语法检查 run: | - find . -name "*.php" -not -path "./vendor/*" -exec php -l {} \; + errors=0 + for file in $(find . -name "*.php" -not -path "./vendor/*"); do + if ! php -l "$file" > /dev/null 2>&1; then + echo "❌ 语法错误: $file" + php -l "$file" + errors=$((errors + 1)) + fi + done + if [ $errors -gt 0 ]; then + echo "发现 $errors 个语法错误" + exit 1 + fi + echo "✅ 所有 PHP 文件语法正确" # 单元测试 test: