GitHub Integration

Mesrai integrates seamlessly with GitHub to provide AI-powered code reviews directly in your pull requests.

Overview

The GitHub integration enables:

  • Automatic PR Reviews: AI analyzes every pull request
  • Inline Comments: Contextual suggestions on specific code lines
  • Status Checks: Review results appear in PR checks
  • Review Summaries: High-level analysis of changes
  • Security Scanning: Identify vulnerabilities automatically

Quick Start

Get started with GitHub integration in 3 steps:

  1. Install the App: Install Mesrai GitHub App
  2. Select Repositories: Choose which repos to enable
  3. Start Reviewing: Open a PR and get instant feedback

Features

Automatic Code Review

Every pull request triggers an automatic review:

  • Smart Analysis: Understands your entire codebase context
  • Fast Results: Reviews complete in under 60 seconds
  • Detailed Feedback: Architecture, security, and performance insights

Inline Comments

Mesrai posts comments directly on relevant code lines:

// Mesrai will comment on issues like this:
function processData(data) {
  // ⚠️ Missing input validation
  return data.map((x) => x * 2);
}

Review Status Checks

GitHub status checks show review results:

  • Passed: No critical issues found
  • ⚠️ Warning: Non-blocking suggestions
  • Failed: Critical issues require attention

Configuration

Repository Settings

Configure your repository via the Mesrai Dashboard:

  1. Go to app.mesrai.com → Select your repository
  2. Navigate to SettingsReview Settings
  3. Configure options:
    • Enable/disable auto-review
    • Set review triggers (pull requests, push to main)
    • Configure comment style (conversational, inline, summary)

Ignored Files

Exclude files from reviews via the dashboard:

  1. Go to SettingsFile Exclusions
  2. Add patterns to ignore:
    • Test files: **/*.test.js
    • Build output: dist/**
    • Dependencies: node_modules/**
    • Documentation: *.md

Integration Types

Best for teams and organizations:

  • Easy one-click installation
  • Granular repository permissions
  • Automatic webhook configuration
  • No manual API key management

Install GitHub App →

GitHub Actions

For custom workflows:

# .github/workflows/mesrai.yml
name: Mesrai Review
on:
  pull_request:
    types: [opened, synchronize]
 
jobs:
  review:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
        with:
          fetch-depth: 0
 
      - uses: mesrai/review-action@v1
        with:
          api-key: ${{ secrets.MESRAI_API_KEY }}

Permissions

Mesrai requires these GitHub permissions:

PermissionAccessWhy Needed
Pull requestsRead/WritePost reviews and comments
ContentsReadAnalyze code and files
MetadataReadAccess repo information
ChecksWriteUpdate PR status checks

Review Types

Full Review

Comprehensive analysis of all changes:

@mesrai review --full
  • Deep architectural analysis
  • Performance profiling
  • Security audit
  • Best practices check

Quick Review

Fast feedback on critical issues only:

@mesrai review --quick
  • Syntax errors
  • Critical security issues
  • Breaking changes

Focused Review

Target specific concerns:

@mesrai review security
@mesrai review performance
@mesrai review style

Best Practices

1. Enable Auto-Review

Let Mesrai review every PR automatically:

  1. Go to app.mesrai.com → Repository Settings
  2. Enable Auto-Review toggle
  3. Reviews will trigger automatically on every PR

2. Set Up Branch Protection

Require Mesrai checks before merging:

  1. Go to SettingsBranches
  2. Add rule for main branch
  3. Enable Require status checks to pass
  4. Select mesrai/review

3. Configure Review Depth

Balance speed vs thoroughness via the dashboard:

  1. Go to SettingsReview Depth
  2. Choose context depth: Quick, Medium, or Deep
  3. Set max files to analyze (default: 50)
  4. Enable/disable dependency analysis

4. Use Labels

Trigger specific reviews with labels:

  • mesrai:security - Security-focused review
  • mesrai:performance - Performance analysis
  • mesrai:skip - Skip automatic review

Advanced Features

Custom Rules

Define team-specific rules via the dashboard:

  1. Go to app.mesrai.com → Repository SettingsCustom Rules
  2. Add rules with:
    • Pattern: Regex to match (e.g., console\.log)
    • Severity: warning, error, or info
    • Message: Custom feedback message

Example rules you can configure:

  • “No console.log” - Flag debugging statements
  • “TODO comments” - Track incomplete work
  • “Large functions” - Enforce function size limits

Review Templates

Configure review sections via the dashboard:

  1. Go to SettingsReview Format
  2. Choose which sections to include:
    • Summary
    • Security analysis
    • Performance insights
    • Suggestions
    • Best practices

Metrics & Analytics

Track review effectiveness:

  • Review Coverage: % of PRs reviewed
  • Issue Detection: Critical bugs caught
  • Time Savings: Hours saved on manual review
  • Code Quality Trends: Quality improvements over time

Webhook Events

Mesrai listens to these GitHub webhooks:

  • pull_request (opened, synchronize, reopened)
  • pull_request_review (submitted, edited)
  • pull_request_review_comment (created)
  • push (to protected branches)
  • issue_comment (for manual triggers)

Rate Limits

GitHub API rate limits:

  • Authenticated: 5,000 requests/hour
  • GitHub App: 15,000 requests/hour (Mesrai uses this)
  • Webhooks: No rate limit

Mesrai optimizes API usage to stay within limits.

Troubleshooting

Reviews Not Triggering

  1. Check webhook deliveries in repo settings
  2. Verify repository is in app installation
  3. Confirm auto-review is enabled in dashboard settings
  4. Check Status Page

Permission Issues

  1. Reinstall GitHub App with required permissions
  2. Verify organization allows third-party apps
  3. Check if repo is in private mode

Slow Reviews

  1. Reduce max_files in configuration
  2. Use --quick mode for faster results
  3. Check if repo has very large files

Security & Privacy

Mesrai takes security seriously:

  • Code Privacy: Your code is processed in isolated sandbox environments
  • Encrypted Transfer: All data encrypted in transit (TLS 1.3)
  • No Storage: Code is analyzed in memory only and never persisted
  • Secure Authentication: OAuth via GitHub with minimal permissions
  • GDPR Compliant: EU data protection standards

Read full security policy →

Migration Guide

From Other Tools

Migrating from other code review tools:

From CodeRabbit

  1. Uninstall CodeRabbit GitHub App
  2. Install Mesrai GitHub App
  3. Configure settings via dashboard
  4. Test on a sample PR

From GitHub Copilot Reviews

  1. Keep Copilot for code completion
  2. Add Mesrai for PR reviews
  3. Both tools work together seamlessly

Next Steps

Support

Need help with GitHub integration?