An AI-powered GitHub App that intelligently backports pull requests across branches.
- AI-Powered Analysis: Understands code changes and predicts backport feasibility
- Automatic Conflict Resolution: Uses AI to resolve merge conflicts when possible
- Isolated Execution: Runs git operations in Vercel Sandbox for safety
- Real-time Dashboard: Track backport jobs and view detailed logs
- GitHub Integration: Responds to comments on pull requests
- Trigger: Comment on a merged PR with
@agent-backport backport to <branch> - Analyze: AI analyzes the changes and target branch for compatibility
- Execute: Cherry-picks commits in an isolated sandbox environment
- Resolve: AI attempts to resolve any merge conflicts
- Create PR: Opens a new pull request with the backported changes
- Next.js 16 - React framework with App Router
- Vercel AI SDK - AI-powered code analysis
- Vercel AI Gateway - Unified AI model access
- Vercel Workflow DevKit - Durable workflows
- Vercel Sandbox - Isolated git operations
- Octokit - GitHub API client
- Node.js 18+
- A Vercel account
- A GitHub account with permission to create GitHub Apps
- Go to GitHub Developer Settings
- Click "New GitHub App"
- Configure the app:
- Name:
agent-backport(or your preferred name) - Homepage URL: Your Vercel deployment URL
- Webhook URL:
https://your-app.vercel.app/api/github/webhooks - Webhook Secret: Generate a secure random string
- Permissions:
- Repository: Contents (Read & Write)
- Repository: Pull requests (Read & Write)
- Repository: Issues (Read & Write)
- Events: Issue comment
- Name:
- Generate and download a private key
- Note your App ID and Client ID/Secret
Or deploy manually:
# Clone the repository
git clone https://github.com/agent-backport/app.git
cd agent-backport
# Install dependencies
npm install
# Deploy to Vercel
vercelSet these in your Vercel project settings:
# GitHub App
GITHUB_APP_ID=your_app_id
GITHUB_APP_PRIVATE_KEY="-----BEGIN RSA PRIVATE KEY-----\n...\n-----END RSA PRIVATE KEY-----"
GITHUB_WEBHOOK_SECRET=your_webhook_secret
# GitHub OAuth (for dashboard login)
GITHUB_CLIENT_ID=your_client_id
GITHUB_CLIENT_SECRET=your_client_secret
# Vercel AI Gateway
AI_GATEWAY_API_KEY=your_ai_gateway_key
# NextAuth
NEXTAUTH_SECRET=generate_a_random_string
NEXTAUTH_URL=https://your-app.vercel.app- Go to your GitHub App settings
- Click "Install App"
- Select the repositories you want to enable backporting for
On any merged pull request, comment:
@agent-backport backport to release-v5.0
The bot will:
- React with 👀 to acknowledge the request
- Analyze the changes
- Attempt the backport
- Comment with the result (success link or failure reason)
Visit your deployment URL to sign in with GitHub.
# Install dependencies
npm install
# Set up environment variables
cp .env.example .env.local
# Edit .env.local with your values
# Run development server
npm run dev
# Build for production
npm run buildUse smee.io to forward webhooks to your local machine:
# Install smee client
npm install -g smee-client
# Forward webhooks
smee -u https://smee.io/your-channel -t http://localhost:3000/api/github/webhooksagent-backport/
├── app/
│ ├── api/
│ │ ├── github/webhooks/ # GitHub webhook handler
│ │ └── auth/ # NextAuth.js endpoints
│ ├── page.tsx # Dashboard
│ └── layout.tsx
├── lib/
│ ├── ai.ts # AI analysis functions
│ ├── auth.ts # NextAuth configuration
│ ├── github.ts # GitHub App utilities
│ ├── jobs.ts # Job storage (in-memory)
│ └── sandbox.ts # Vercel Sandbox operations
├── workflows/
│ └── backport.ts # Main backport workflow
└── components/
├── dashboard.tsx # User dashboard
├── login-button.tsx # GitHub OAuth button
└── providers.tsx # Session provider
MIT
Contributions are welcome! Please open an issue or submit a pull request.