更新 .gitea/workflows/test.yml
All checks were successful
Run Unit Tests / test (pull_request) Successful in 3s

This commit is contained in:
james 2025-07-27 22:26:58 +08:00
parent 589458fbbe
commit b59e66eca8

View File

@ -3,6 +3,9 @@ on:
pull_request:
branches:
- main
env:
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
jobs:
test:
runs-on: phpunit_test
@ -11,6 +14,14 @@ jobs:
- name: Checkout code
uses: http://119.91.43.128:3003/james/checkout@v4
- name: Get Pull Request Number
id: get_pr_number
run: |
# 提取 PR 编号(如 pull/14/head -> 14
PULLS_ID=$(git branch | grep -o 'pull/[0-9]\+' | cut -d'/' -f2)
echo "PR ID: $PULLS_ID"
echo "PULLS_ID=$PULLS_ID" >> $GITHUB_ENV
- name: Run code review script
env:
GIT_PROJECT_PATH: /workspace/hui/SCTMES_V5 # Gitea 的工作目录
@ -37,5 +48,20 @@ jobs:
如果没有发现相关问题请一定输出以下JSON格式
{"status": "passed"}
run: |
PR_NUMBER=$PULLS_ID
OWNER="hui"
REPO="SCTMES_V5"
SERVER_URL="http://119.91.43.128:3003"
COMMENT="🧪 单元测试已完成。\n- 状态: 成YYYYY功 ✅\n- Commit ID: $(git rev-parse HEAD)\n- 查看日志: [Actions](https://your-ci-link-here)"
API_URL="$SERVER_URL/api/v1/repos/$OWNER/$REPO/issues/$PR_NUMBER/comments"
curl -X POST \
-H "Authorization: token $GITEA_TOKEN" \
-H "Content-Type: application/json" \
-d "{\"body\": \"$COMMENT\"}" \
"$API_URL"
cd /workspace
./audit_code.sh