1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Devin のレビュアーが欲しい

Figma のデザインデータを使って Devin でフロントエンドをつくってもらいました。

ここでは、ザックリとしたデザインデータを使ったというのもあり、色々と修正が必要になりました。そこで Devin の PR を CodeRabbit でレビューさせて、より頑健で再現性の高いコードをつくっていきます。

左:Devin、右:Figma
image.png

レビューはこんな感じ。色々な機能があるので是非試してみてください。

image.png

普通にやってみると Devin の PR がスキップされる

早速、Devin に PR をつくってもらいましたが、レビューされませんでした。

image.png

どうやら Bot として検出された場合はスキップされるようです。

どうするか

1. ユーザーがコメントする

以下のように手動で、というか自分でコメントを追加するとレビューが実行されました。

@coderabbitai
Full review

image.png

ただし、これは古い PR にトリガーさせるやり方としても紹介されています。

CodeRabbit のFAQより↓

When Does CodeRabbit Review PRs?
✅ New PRs: Automatic review when created
✅ New Commits: Automatic review when pushed to any PR
⚡ Older PRs: Use @coderabbitai review to trigger manually

これでも良いですが、自動で進めたいですね。

2. 「1.」を Devin にやらせる

これは失敗です。 つまり、Devin が PR をつくった時にコメントで@coderabbitai reviewを入れるというやり方です。残念ながら、bot としてみなされスキップ処理されてしまいました。

image.png

3. Devin を bot ではなく User にする

settingsintegrationsGitHubと進むとPR Authorという項目を発見します。
これを User にすれば bot 扱いされないはず...

image.png

上手くいきました!

image.png

この場合、以下のように PR を行ったユーザーが Devin ではなく User になります。

image.png

Devin が PR をする場合は、CodeRabbit はスキップする。
image.png

@coderabbitai reviewをコメントに入れる必要はありません。

4. GitHub Actions でレビューを指示する

こちらも特に問題なくうまくいきました。

image.png

name: Trigger CodeRabbit review on Devin PR

on:
  pull_request:
    types: [opened]

jobs:
  request-coderabbit-review:
    if: github.event.pull_request.user.login == 'devin-ai-integration[bot]'

    runs-on: ubuntu-latest
    timeout-minutes: 2

    permissions:
      issues: write
      pull-requests: write

    steps:
      - name: Comment "@coderabbitai review"
        uses: actions/github-script@v7
        with:
          github-token: ${{ github.token }}
          script: |
            const { owner, repo } = context.repo;
            const issue_number = context.issue.number;

            await github.rest.issues.createComment({
              owner,
              repo,
              issue_number,
              body: '@coderabbitai review',
            });

レビューは良好

ポテンシャルイシューや AI エージェント用のプロンプトも書いてくれるのはいいですね。
勉強にもなります。

image.png

1
0
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
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?