更新 .gitea/workflows/code-review.yml
This commit is contained in:
@@ -11,41 +11,13 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
- name: OpenAI Code Review
|
- name: Comment on PR
|
||||||
uses: sgxya/gitea-code-review-action@main
|
uses: sgxya/pr-comment-action@v1
|
||||||
# env:
|
|
||||||
# # 可直连则删除本行;需代理则改成你的代理地址
|
|
||||||
# OPENAI_PROXY: https://aiyjg.lol
|
|
||||||
# NODE_TLS_REJECT_UNAUTHORIZED: '0'
|
|
||||||
with:
|
with:
|
||||||
SOURCE_AT: gitea
|
body: "✅ 构建完成!"
|
||||||
GITHUB_BASE_URL: 'https://devstar.cn'
|
token: ${{ secrets.GITEA_TOKEN }}
|
||||||
OPENAI_BASE_URL: 'https://aiyjg.lol'
|
server: https://devstar.cn
|
||||||
PROGRAMMING_LANGUAGE: 'JavaScript' # 避免使用 auto
|
owner: beppeb
|
||||||
FULL_REVIEW_COMMENT: openai
|
repo: demo-workflow-repo
|
||||||
REVIEW_COMMENT_PREFIX: 'openai:'
|
pr_number: ${{ github.event.pull_request.number }}
|
||||||
MAX_CODE_LENGTH: 6000
|
|
||||||
OPENAI_TOKEN: ${{ secrets.OPENAI_TOKEN }}
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
|
|
||||||
|
|
||||||
- name: Comment on PR when AI review fails (Gitea API)
|
|
||||||
if: failure() # 仅在 AI Review 步骤失败时执行
|
|
||||||
env:
|
|
||||||
GITEA_BASE_URL: https://devstar.cn
|
|
||||||
TOKEN: ${{ secrets.GH_TOKEN }} # 或者使用你在 Gitea 配置的 PAT
|
|
||||||
OWNER: ${{ github.repository_owner }}
|
|
||||||
REPO: ${{ github.event.repository.name }}
|
|
||||||
ISSUE_NUMBER: ${{ github.event.issue.number }} # PR 在 API 上也是 issue
|
|
||||||
run: |
|
|
||||||
set -e
|
|
||||||
api="$GITEA_BASE_URL/api/v1/repos/$OWNER/$REPO/issues/$ISSUE_NUMBER/comments"
|
|
||||||
body=$(cat <<'EOF'
|
|
||||||
{
|
|
||||||
"body": "AI 自动审查未通过,请根据机器人评论修复问题后,在此评论 `openai` 以重新触发审查。"
|
|
||||||
}
|
|
||||||
EOF
|
|
||||||
)
|
|
||||||
curl -sS -X POST "$api" \
|
|
||||||
-H "Content-Type: application/json" \
|
|
||||||
-H "Authorization: token $TOKEN" \
|
|
||||||
--data "$body"
|
|
||||||
Reference in New Issue
Block a user