Merge pull request '更新 .gitea/workflows/test.yml' (#32) from james-patch-20 into main
Reviewed-on: #32
This commit is contained in:
commit
0e2da9efb8
@ -3,6 +3,9 @@ on:
|
|||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
|
env:
|
||||||
|
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
runs-on: phpunit_test
|
runs-on: phpunit_test
|
||||||
@ -11,6 +14,14 @@ jobs:
|
|||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: http://119.91.43.128:3003/james/checkout@v4
|
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
|
- name: Run code review script
|
||||||
env:
|
env:
|
||||||
GIT_PROJECT_PATH: /workspace/hui/SCTMES_V5 # Gitea 的工作目录
|
GIT_PROJECT_PATH: /workspace/hui/SCTMES_V5 # Gitea 的工作目录
|
||||||
@ -37,5 +48,20 @@ jobs:
|
|||||||
如果没有发现相关问题,请一定输出以下JSON格式:
|
如果没有发现相关问题,请一定输出以下JSON格式:
|
||||||
{"status": "passed"}
|
{"status": "passed"}
|
||||||
run: |
|
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
|
cd /workspace
|
||||||
./audit_code.sh
|
./audit_code.sh
|
Loading…
x
Reference in New Issue
Block a user