diff --git a/.gitea/workflows/test.yml b/.gitea/workflows/test.yml index c9900b4..a63e705 100644 --- a/.gitea/workflows/test.yml +++ b/.gitea/workflows/test.yml @@ -19,8 +19,15 @@ jobs: run: | # 提取 PR 编号(如 pull/14/head -> 14) PULLS_ID=$(git branch | grep -o 'pull/[0-9]\+' | cut -d'/' -f2) + if [ -z "$PULLS_ID" ]; then + echo "❌ 无法提取 PR 编号" + exit 1 + fi echo "PR ID: $PULLS_ID" + # 写入 GITHUB_ENV(可选,兼容旧脚本) echo "PULLS_ID=$PULLS_ID" >> $GITHUB_ENV + # 写入 outputs,供后续步骤使用 + echo "pr_number=$PULLS_ID" >> $GITHUB_OUTPUT - name: Run code review script env: @@ -30,8 +37,8 @@ jobs: IGNORED_PATHS: '["EdgeManager/vendor/**", "mes_in_sct/vendor/**", "mes_in_task/vendor/**", "webman/public/**", "webman/runtime/**", "webman/vendor/**"]' # 忽略检测目录 # === Gitea API 配置(传给 audit_code.sh)=== - API_URL: "http://119.91.43.128:3003/api/v1/repos/hui/SCTMES_V5/issues/$PULLS_ID/comments" - GITEA_TOKEN: $GITEA_TOKEN + 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 }} SYSTEM_PROMPT: | 你是代码审核助手,我需要你审核代码后以JSON形式输出通过(passed)或者不通过(no-passed),只输出json不添加其他说明。