Skip to main content
手動でのセットアップが面倒ですか?このページのリンクを Devin のセッションに貼り付けて、すべてのセットアップを依頼してください。
1

Store your Devin API key in GitHub

The workflow calls Devin’s v3 API to create sessions programmatically. Create a service user and store its token as a GitHub Actions secret:
  1. Go to app.devin.ai > Settings > Service Users and create a service user with ManageOrgSessions permission
  2. Copy the API token shown after creation — it’s only displayed once
  3. In your GitHub repo, navigate to Settings > Secrets and variables > Actions
  4. Add two secrets: DEVIN_API_KEY (the token) and DEVIN_ORG_ID (your organization ID — get it by calling GET https://api.devin.ai/v3/enterprise/organizations with your token)
Devin がリポジトリをクローン、ビルド、プッシュできるように、リポジトリがすでに Devin の Machine でセットアップ済み であることを確認してください。
2

ワークフローファイルを追加する

Create .github/workflows/devin-ci-fix.yml. This workflow fires whenever your existing CI workflow completes with a failure, extracts the failing job names, and calls the Devin API to start a fix session:
Replace "CI" in the workflows array with the exact name: from your existing CI workflow file (e.g., "Tests", "Build & Test").Use the tags field in the request body (e.g., "tags": ["ci-fix", "pr-312"]) to track which CI failures have already triggered sessions and avoid duplicates.
3

What happens when CI fails

PR の CI 実行が失敗すると、Action が失敗の詳細を抽出し、セッションプロンプトとして Devin に渡します。以下は、典型的な自動修正のフローです。
  1. CI ログを読み取る — Devin が実行 URL を開き、失敗したジョブのエラー出力、スタックトレース、テスト結果を解析します
  2. エラーをコードまでたどる — PR ブランチ上の関連するファイルと行 (例: UserList.tsx:34) を特定し、その周辺コードと直近の差分を読み取ります
  3. 修正をプッシュする — 狙いを絞った変更を PR ブランチに直接コミットし、これにより CI が自動的に再トリガーされます
  4. PR にコメントする — root cause と変更内容を説明する要約を投稿します
Devin による PR コメントの例:
4

対象を適切な失敗に絞る

すべての CI の失敗が自動修正の恩恵を受けられるわけではありません。インフラのタイムアウトや Docker ビルドの問題は、コード変更では解決できません。関連するジョブの失敗のときにだけ Devin がトリガーされるよう、条件を追加してください。

修正はレビューしやすい状態に保つ

Devin は修正コミットをプッシュしますが、PR をマージする前には引き続き人間によるレビューが必要です。自動修正はコードレビューの代替ではなく、開発者にとってのたたき台として扱ってください。Devin が失敗を解決できない場合は、PR 上にコメントして判明した内容を説明し、エンジニアがそこから引き継げるようにします。