***v32 #32

Merged
gitea merged 1 commits from mitch into develop 2026-07-09 19:07:35 +00:00
2 changed files with 37 additions and 1 deletions

View File

@ -27,6 +27,7 @@ steps:
- pull_request
# AI コードレビューskip-ai-review ラベル付き PR はスキップ)
# 成功時に ai-reviewed ラベルを Gitea API で付与
ai-review:
image: ghcr.io/slb350/drep:latest
environment:
@ -70,6 +71,41 @@ steps:
echo "★ Running drep review for ${CI_REPO} PR #${CI_COMMIT_PULL_REQUEST}"
drep review "${CI_REPO}" "${CI_COMMIT_PULL_REQUEST}"
echo "★ Adding ai-reviewed label to PR #${CI_COMMIT_PULL_REQUEST}"
GITEA_API="https://gitea.git.mitchecp.com/api/v1"
REPO_API="${GITEA_API}/repos/${CI_REPO_OWNER}/${CI_REPO_NAME}"
HAS_LABEL=$(curl -fsS \
-H "Authorization: token ${GITEA_TOKEN}" \
"${REPO_API}/issues/${CI_COMMIT_PULL_REQUEST}" \
| python3 -c "import json,sys; labels=json.load(sys.stdin).get('labels',[]); print('yes' if any(l.get('name')=='ai-reviewed' for l in labels) else 'no')")
if [ "$HAS_LABEL" = "yes" ]; then
echo "Label ai-reviewed already present on PR #${CI_COMMIT_PULL_REQUEST}"
else
LABEL_ID=$(curl -fsS \
-H "Authorization: token ${GITEA_TOKEN}" \
"${REPO_API}/labels" \
| python3 -c "import json,sys; print(next((l['id'] for l in json.load(sys.stdin) if l.get('name')=='ai-reviewed'), ''))")
if [ -z "$LABEL_ID" ]; then
LABEL_ID=$(curl -fsS -X POST \
-H "Authorization: token ${GITEA_TOKEN}" \
-H "Content-Type: application/json" \
-d '{"name":"ai-reviewed","color":"0e8a16","description":"Drep AI review completed by Woodpecker"}' \
"${REPO_API}/labels" \
| python3 -c "import json,sys; print(json.load(sys.stdin)['id'])")
fi
curl -fsS -X POST \
-H "Authorization: token ${GITEA_TOKEN}" \
-H "Content-Type: application/json" \
-d "{\"labels\":[${LABEL_ID}]}" \
"${REPO_API}/issues/${CI_COMMIT_PULL_REQUEST}/labels"
echo "Added ai-reviewed label to PR #${CI_COMMIT_PULL_REQUEST}"
fi
when:
event:
- pull_request

View File

@ -1,2 +1,2 @@
<?php
echo "Hello, World! - v31";
echo "Hello, World! - v32";