1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

OpenCode と GitHub Actions による pull request レビュー自動化

1
Last updated at Posted at 2026-08-25

TL;DR

  • OpenCode を GitHub Actions 上で実行する opencode-action を紹介
  • opencode-action は pull request をレビューする専用コマンドを搭載

image.png
概念図 (ChatGPT で描画)

Quick Start

さくらの AI Engine を provider として preview/Kimi-K2.7-Code を使用する例を示す.
GitHub repository に SAKURA_AI_ENGINE_API_KEY を secret として登録し, 次のような workflow を追加することで, OpenCode が pull request をレビューして指摘事項を GitHub review として投稿する.

---
name: AI Review
on:
  pull_request:
    types: [opened, reopened, synchronize, ready_for_review]
permissions:
  contents: read
  pull-requests: write
  id-token: write
jobs:
  review:
    if: github.event.pull_request.draft == false
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
        with:
          persist-credentials: false
      - name: Review pull request
        uses: dceoy/opencode-action@e5a3599d8b64f9adda6a03a18c8b0b9d077ffebb # v0.7.0
        env:
          SAKURA_AI_ENGINE_API_KEY: ${{ secrets.SAKURA_AI_ENGINE_API_KEY }}
          GITHUB_TOKEN: ${{ github.token }}
        with:
          model: sakura/preview/Kimi-K2.7-Code
          prompt: /review-pr

レビュー観点を限定することも可能.

/review-pr security
/review-pr tests docs
/review-pr performance

詳細な設定は Pull request reviews を参照のこと.

Discussion

opencode-action は, OpenCode の提供する公式 Action に対して以下の点が異なる:

  • pull request レビュー専用の /review-pr
    • diff とリスクに応じて review task を動的に分割
    • discovery と validation を独立した session で実行
    • 検証済みの指摘を GitHub の structured review / inline comment として投稿
  • GitHub Actions の supply-chain security を強化
  • さくらの AI Engine の provider configuration を内蔵
    • SAKURA_AI_ENGINE_API_KEY と model の指定のみで利用可

なお opencode-action は公式 Action と同様, レビュー以外の汎用タスクにも適用可能.

References

1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?