From a79a2d9ef620d217851455aeb15dfef4f7e0a328 Mon Sep 17 00:00:00 2001 From: MoeFurina Date: Sun, 2 Aug 2026 16:19:40 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=AD=A3workflow=E6=96=87?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/opencode.yml | 2 -- .github/workflows/pr-reviewer.yml | 46 +++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/pr-reviewer.yml diff --git a/.github/workflows/opencode.yml b/.github/workflows/opencode.yml index 3b20e7b..c682552 100644 --- a/.github/workflows/opencode.yml +++ b/.github/workflows/opencode.yml @@ -5,8 +5,6 @@ on: types: [created] pull_request_review_comment: types: [created] - pull_request: - types: [opened, synchronize, reopened, ready_for_review] issues: types: [opened] diff --git a/.github/workflows/pr-reviewer.yml b/.github/workflows/pr-reviewer.yml new file mode 100644 index 0000000..187ea33 --- /dev/null +++ b/.github/workflows/pr-reviewer.yml @@ -0,0 +1,46 @@ +name: opencode-review + +on: + pull_request: + types: [opened, synchronize, reopened, ready_for_review] + +permissions: + contents: read + +jobs: + review: + # 跳过 fork 来的 PR:GitHub 不会把 secrets 传给 fork PR 触发的工作流, + # 跑了也必然失败,所以直接跳过避免噪音(平台限制,非配置问题)。 + if: github.event.pull_request.head.repo.fork == false + runs-on: ubuntu-latest + steps: + - name: Generate bot token + id: token + uses: actions/create-github-app-token@v1 + with: + app-id: ${{ secrets.APP_ID }} + private-key: ${{ secrets.APP_PRIVATE_KEY }} + owner: ${{ github.repository_owner }} + + - name: Checkout + uses: actions/checkout@v6 + with: + persist-credentials: false + token: ${{ steps.token.outputs.token }} + + - name: Configure git identity + run: | + git config --global user.name "takanashi-hoshino-agent[bot]" + git config --global user.email "takanashi-hoshino-agent[bot]@users.noreply.github.com" + + - name: Run opencode review + uses: anomalyco/opencode/github@latest + env: + OPENCODE_API_KEY: ${{ secrets.OPENCODE_API_KEY }} + # 用自定义 GitHub App 生成的 bot token,跟原 opencode.yml 一致, + # 评论 PR / 提交都走 takanashi-hoshino-agent[bot] 的身份。 + GITHUB_TOKEN: ${{ steps.token.outputs.token }} + with: + model: opencode/deepseek-v4-flash-free + use_github_token: true + prompt: ${{ secrets.OPENCODE_PROMPT }}