更新 .gitea/workflows/code-review.yml

This commit is contained in:
2025-08-19 10:08:42 +00:00
parent 8eb51e4202
commit d15d2827ff

View File

@@ -7,38 +7,17 @@ jobs:
review: review:
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: github.event.issue.pull_request && (startsWith(github.event.comment.body, 'openai') || github.event.comment.body == 'openai') if: github.event.issue.pull_request && (startsWith(github.event.comment.body, 'openai') || github.event.comment.body == 'openai')
env:
ACTIONS_STEP_DEBUG: 'true' # 打开调试,能看到更多日志
BASE: https://devstar.cn
GH_TOKEN: ${{ secrets.GH_TOKEN }}
steps: steps:
- name: Preflight - diff 接口可用性
run: |
set -e
echo "repo=${{ github.repository }}"
echo "issue.number=${{ github.event.issue.number }}"
curl -sSf -H "Authorization: token $GH_TOKEN" "$BASE/api/v1/repos/${{ github.repository }}/pulls/${{ github.event.issue.number }}.diff" >/dev/null
echo "diff endpoint OK"
- name: Preflight - 评论接口可用性
run: |
set -e
curl -sSf -X POST \
-H "Authorization: token $GH_TOKEN" \
-H "Content-Type: application/json" \
-d '{"body":"healthcheck from workflow"}' \
"$BASE/api/v1/repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/comments" >/dev/null
echo "comment endpoint OK"
- name: OpenAI Code Review - name: OpenAI Code Review
uses: ingress-it-solutions/gitea-code-review-action@v0.1 uses: ingress-it-solutions/gitea-code-review-action@v0.1
with: with:
SOURCE_AT: gitea SOURCE_AT: gitea
GITHUB_BASE_URL: https://devstar.cn GITHUB_BASE_URL: https://devstar.cn
PROGRAMMING_LANGUAGE: 'JavaScript' # 避免用 autov0.1 有变量赋值/作用域问题 # v0.1 存在 auto 的赋值与变量作用域问题,建议先用显式语言
PROGRAMMING_LANGUAGE: 'JavaScript'
FULL_REVIEW_COMMENT: openai FULL_REVIEW_COMMENT: openai
REVIEW_COMMENT_PREFIX: 'openai:' REVIEW_COMMENT_PREFIX: 'openai:'
MAX_CODE_LENGTH: 6000 MAX_CODE_LENGTH: 6000
OPENAI_TOKEN: ${{ secrets.OPENAI_TOKEN }} OPENAI_TOKEN: ${{ secrets.OPENAI_TOKEN }}
# 这里必须是 Gitea 的 PAT可读 PR、可在 Issue/PR 评论)
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}