From 8eb51e420297a69ad320a94305a51a7a139e09f2 Mon Sep 17 00:00:00 2001 From: beppeb Date: Tue, 19 Aug 2025 09:30:52 +0000 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20.gitea/workflows/code-revi?= =?UTF-8?q?ew.yml?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/code-review.yml | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/.gitea/workflows/code-review.yml b/.gitea/workflows/code-review.yml index c325b97..e112334 100644 --- a/.gitea/workflows/code-review.yml +++ b/.gitea/workflows/code-review.yml @@ -8,16 +8,37 @@ jobs: runs-on: ubuntu-latest if: github.event.issue.pull_request && (startsWith(github.event.comment.body, 'openai') || github.event.comment.body == 'openai') env: - ACTIONS_STEP_DEBUG: 'true' # 可选,便于查看调试日志 + ACTIONS_STEP_DEBUG: 'true' # 打开调试,能看到更多日志 + BASE: https://devstar.cn + GH_TOKEN: ${{ secrets.GH_TOKEN }} + 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 uses: ingress-it-solutions/gitea-code-review-action@v0.1 with: SOURCE_AT: gitea - GITHUB_BASE_URL: https://devstar.cn # 若有子路径/端口,请改成真实根地址 - PROGRAMMING_LANGUAGE: 'JavaScript' # 避免使用 auto + GITHUB_BASE_URL: https://devstar.cn + PROGRAMMING_LANGUAGE: 'JavaScript' # 避免用 auto,v0.1 有变量赋值/作用域问题 FULL_REVIEW_COMMENT: openai REVIEW_COMMENT_PREFIX: 'openai:' MAX_CODE_LENGTH: 6000 OPENAI_TOKEN: ${{ secrets.OPENAI_TOKEN }} - GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} # 需为 Gitea PAT,具备对 PR/Issue 评论权限 \ No newline at end of file + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} \ No newline at end of file