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 }}