Skip to main content
← Back to workflows

How to Integrate AI-Based PR Reviewer & Summarizer with Chat Capabilities in GitHub Actions

coderabbitai-ai-pr-reviewer -
GitHub Action
1.16.2
GitHub Org's stars
Contributors
Categories
CICube banner
The GitHub Actions dashboard helps you spot bottlenecks and optimize your CI pipeline with actionable insights.
Usage
name: 'Usage of ai-pr-reviewer GitHub Action'

permissions:
contents: read
pull-requests: write
concurrency:
group:
${{ github.repository }}-${{ github.event.number || github.head_ref ||
github.sha }}-${{ github.workflow }}-${{ github.event_name ==
'pull_request_review_comment' && 'pr_comment' || 'pr' }}
cancel-in-progress: ${{ github.event_name != 'pull_request_review_comment' }}

on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: coderabbitai/ai-pr-reviewer@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
with:
debug: false
review_simple_changes: false
review_comment_lgtm: false

ai-pr-reviewer logo

AI PR Reviewer

AI-based Pull Request Summarizer and Reviewer with Chat Capabilities.


What is ai-pr-reviewer?

CodeRabbit ai-pr-reviewer helps to automate and enhance the process of code review with insights, summaries, and interactive chat capabilities right inside GitHub pull requests. Based on the latest trends in AI, the tool will analyze changes of the code to give contextually relevant feedback in such a way that it makes the process of review both effective and comprehensive.

Choosing the Right Model for the Task

1. When to Use gpt-3.5-turbo

For lighter tasks such as summarizing changes in pull requests, the gpt-3.5-turbo model is recommended due to its efficiency and cost-effectiveness. It’s described as “dirt cheap” and is suitable for quick analyses and generating summaries of the proposed modifications.

Configuration Example for Light Tasks:

uses: coderabbit/ai-pr-reviewer@latest
with:
openai_light_model: 'gpt-3.5-turbo'
github-token: ${{ secrets.GITHUB_TOKEN }}

2. When to Use gpt-4.0

For more comprehensive and nuanced code review and commenting tasks, the gpt-4 model is preferred. Although significantly more expensive, the quality of the insights and recommendations justifies the cost, especially for a team of developers where the daily cost averages around $20 for a team of 20.

Configuration Example for Complex Tasks:

uses: coderabbit/ai-pr-reviewer@latest
with:
openai_heavy_model: 'gpt-4'
github-token: ${{ secrets.GITHUB_TOKEN }}

Managing Costs Be aware of the operational costs:

gpt-3.5-turbo: Cost-effective for routine tasks. • gpt-4: Higher cost but provides superior results for complex reviews.

Customizing the AI Reviewer

You can also personalize the AI’s approach and style by configuring the system_message value. This allows the AI to adapt its language and focus based on the specific needs of your project or the nature of the content being reviewed.

steps:
- name: AI Review for DevRel
uses: coderabbit/ai-pr-reviewer@latest
with:
system_message: |
You are `@coderabbitai` (aka `github-actions[bot]`), a language model
trained by OpenAI. Your purpose is to act as a highly experienced
DevRel (developer relations) professional with a focus on cloud-native
infrastructure.
When reviewing or generating content focus on key areas such as:
- Accuracy
- Relevance
- Clarity
- Technical depth
- Call-to-action
- SEO optimization
- Brand consistency
- Grammar and prose
- Typos
- Hyperlink suggestions
- Graphics or images
- Empathy
- Engagement

By adjusting these settings, the AI can provide more targeted and relevant feedback, enhancing the effectiveness of your automated reviews.

Monitoring GitHub Actions Workflows

CICube is a GitHub Actions monitoring tool that provides you with detailed insights into your workflows to further optimize your CI/CD pipeline. With CICube, you will be able to track your workflow runs, understand where the bottlenecks are, and tease out the best from your build times. Go to cicube.io now and create a free account to better optimize your GitHub Actions workflows!

CICube GitHub Actions Workflow Duration Monitoring