From b1de40b1e595781f78e76a8638b1b67bc25ebae6 Mon Sep 17 00:00:00 2001 From: t8y2 <1156263951@qq.com> Date: Sat, 9 May 2026 18:33:50 +0800 Subject: [PATCH] chore(ci): remove auto-review workflow --- .github/workflows/auto-review.yml | 79 ------------------------------- 1 file changed, 79 deletions(-) delete mode 100644 .github/workflows/auto-review.yml diff --git a/.github/workflows/auto-review.yml b/.github/workflows/auto-review.yml deleted file mode 100644 index ecb6ae60b..000000000 --- a/.github/workflows/auto-review.yml +++ /dev/null @@ -1,79 +0,0 @@ -name: Auto Review - -on: - pull_request_target: - types: [opened, synchronize] - -jobs: - review: - runs-on: ubuntu-latest - permissions: - pull-requests: write - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Get PR diff - env: - GH_TOKEN: ${{ github.token }} - run: | - gh pr diff ${{ github.event.pull_request.number }} > /tmp/pr.diff - head -c 30000 /tmp/pr.diff > /tmp/pr_truncated.diff - - - name: Review with DeepSeek - id: review - env: - DEEPSEEK_API_KEY: ${{ secrets.DEEPSEEK_API_KEY }} - PR_TITLE: ${{ github.event.pull_request.title }} - PR_BODY: ${{ github.event.pull_request.body }} - run: | - python3 - <<'PYEOF' - import os, json, urllib.request - - diff = open("/tmp/pr_truncated.diff").read() - title = os.environ.get("PR_TITLE", "") - body = os.environ.get("PR_BODY", "")[:2000] - api_key = os.environ["DEEPSEEK_API_KEY"] - - payload = json.dumps({ - "model": "deepseek-v4-pro", - "messages": [ - { - "role": "system", - "content": "你是一个专业的代码审查员。请审查以下 Pull Request 的代码变更,给出简洁的中文评审意见。重点关注:1. 潜在的 bug 或逻辑错误 2. 安全问题 3. 性能问题 4. 代码风格和可读性。如果代码没有问题,简单说 LGTM 并给出简短总结。不要逐行重复代码。" - }, - { - "role": "user", - "content": f"PR 标题: {title}\n\nPR 描述: {body}\n\n代码变更:\n{diff}" - } - ], - "max_tokens": 2000 - }).encode() - - req = urllib.request.Request( - "https://api.deepseek.com/chat/completions", - data=payload, - headers={ - "Authorization": f"Bearer {api_key}", - "Content-Type": "application/json", - }, - ) - - with urllib.request.urlopen(req, timeout=120) as resp: - data = json.loads(resp.read()) - - review = data["choices"][0]["message"]["content"] - - with open(os.environ["GITHUB_OUTPUT"], "a") as f: - delim = "EOF_REVIEW" - f.write(f"comment<<{delim}\n{review}\n{delim}\n") - PYEOF - - - name: Post review comment - env: - GH_TOKEN: ${{ github.token }} - REVIEW: ${{ steps.review.outputs.comment }} - run: | - printf '🤖 **Auto Review by DeepSeek**\n\n%s' "$REVIEW" > /tmp/comment.md - gh pr comment ${{ github.event.pull_request.number }} --body-file /tmp/comment.md