Merge pull request '更新 .gitea/workflows/test.yml' (#37) from james-patch-25 into main

Reviewed-on: #37
This commit is contained in:
james 2025-07-27 23:48:01 +08:00
commit 644a797b79

View File

@ -17,16 +17,16 @@ jobs:
- name: Get Pull Request Number - name: Get Pull Request Number
id: get_pr_number id: get_pr_number
run: | run: |
# 提取 PR 编号(如 pull/14/head -> 14 # 提取 PR 编号(如 pull/14/head -> 14)
PULLS_ID=$(git branch | grep -o 'pull/[0-9]\+' | cut -d'/' -f2) PULLS_ID=$(git branch | grep -o 'pull/[0-9]\+' | cut -d'/' -f2)
if [ -z "$PULLS_ID" ]; then if [ -z "$PULLS_ID" ]; then
echo "❌ 无法提取 PR 编号" echo "❌ 无法提取 PR 编号"
exit 1 exit 1
fi fi
echo "PR ID: $PULLS_ID" echo "PR ID: $PULLS_ID"
# 写入 GITHUB_ENV(可选,兼容旧脚本) # 写入 GITHUB_ENV(可选,兼容旧脚本)
echo "PULLS_ID=$PULLS_ID" >> $GITHUB_ENV echo "PULLS_ID=$PULLS_ID" >> $GITHUB_ENV
# 写入 outputs供后续步骤使用 # 写入 outputs,供后续步骤使用
echo "pr_number=$PULLS_ID" >> $GITHUB_OUTPUT echo "pr_number=$PULLS_ID" >> $GITHUB_OUTPUT
- name: Run code review script - name: Run code review script
@ -36,16 +36,16 @@ jobs:
ALLOWED_PATHS: '["EdgeManager/**", "mes_in_sct/**", "mes_in_task/**", "webman/**"]' # 允许检测目录 ALLOWED_PATHS: '["EdgeManager/**", "mes_in_sct/**", "mes_in_task/**", "webman/**"]' # 允许检测目录
IGNORED_PATHS: '["EdgeManager/vendor/**", "mes_in_sct/vendor/**", "mes_in_task/vendor/**", "webman/public/**", "webman/runtime/**", "webman/vendor/**"]' # 忽略检测目录 IGNORED_PATHS: '["EdgeManager/vendor/**", "mes_in_sct/vendor/**", "mes_in_task/vendor/**", "webman/public/**", "webman/runtime/**", "webman/vendor/**"]' # 忽略检测目录
# === Gitea API 配置(传给 audit_code.sh=== # === Gitea API 配置(传给 audit_code.sh)===
API_URL: "http://119.91.43.128:3003/api/v1/repos/hui/SCTMES_V5/issues/${{ steps.get_pr_number.outputs.pr_number }}/comments" API_URL: "http://119.91.43.128:3003/api/v1/repos/hui/SCTMES_V5/issues/${{ steps.get_pr_number.outputs.pr_number }}/comments"
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }} GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
SYSTEM_PROMPT: | SYSTEM_PROMPT: |
你是代码审核助手我需要你审核代码后以JSON形式输出通过(passed)或者不通过(no-passed)只输出json不添加其他说明。 你是代码审核助手,我需要你审核代码后以JSON形式输出通过(passed)或者不通过(no-passed),只输出json不添加其他说明。
只判断代码是否存在变量拼写错误并且在issues输出行数、出错语句及原因 只判断代码是否存在变量拼写错误,并且在issues输出行数、出错语句及原因
忽略其他错误包括代码安全、SQL 语句内的错误、函数未定义错误、PHP内置函数错误 忽略其他错误,包括代码安全、SQL 语句内的错误、函数未定义错误、PHP内置函数错误
如果代码中出现未定义的变量错误、未定义的方法错误、或其他逻辑错误在suggestion输出你的建议但这部分不作为passed与否的判定 如果代码中出现未定义的变量错误、未定义的方法错误、或其他逻辑错误,在suggestion输出你的建议,但这部分不作为passed与否的判定
最终输出一定遵守以下JSON格式,不允许出现其他格式: 最终输出一定遵守以下JSON格式,不允许出现其他格式:
{ {
"status": "no-passed", "status": "no-passed",
@ -55,10 +55,10 @@ jobs:
"reason": "变量命名xxx不符合规范" "reason": "变量命名xxx不符合规范"
} }
], ],
"suggestion":"代码建议1xxxxx" "suggestion":"代码建议1:xxxxx"
} }
如果没有发现相关问题请一定输出以下JSON格式 如果没有发现相关问题,请一定输出以下JSON格式:
{"status": "passed"} {"status": "passed"}
run: | run: |
PR_NUMBER=$PULLS_ID PR_NUMBER=$PULLS_ID