A GitHub App built with Probot that automatically approves pull requests from specific bots with configured trigger phrases. Perfect for handling Renovate, Dependabot or other automated PRs that can be safely merged without manual review.
- Automatically approves PRs from configured bot users
- Configurable approval triggers in PR bodies
- Option to require all checks to pass before approval
- Specify particular checks that must pass for approval
- Exclude PRs with specific labels from auto-approval
- Re-approves PRs when approvals are dismissed
- Works as a GitHub App or GitHub Action
- Fully tested and follows best practices
Create a .github/auto-approve.yml
(or .yaml
) with the following options:
# Bot usernames whose PRs should be auto-approved
botUsernames:
- renovate[bot]
- dependabot[bot]
- mend-for-github-com[bot]
# Phrases in PR body that indicate the PR should be auto-approved
approvalTriggers:
- "**Automerge**: Enabled"
# Whether to require all checks to pass before approving
requirePassingChecks: true
# Specific checks that must pass for auto-approval (if empty and requirePassingChecks is true, all checks must pass)
requiredChecks:
- build
- test
# Labels that will prevent auto-approval if present on the PR
excludeLabels:
- do-not-merge
- wip
Create a workflow file (e.g., .github/workflows/auto-approve.yaml
):
name: Auto Approve
on:
pull_request:
types: [opened, reopened, synchronize, labeled, edited]
pull_request_review:
types: [dismissed]
check_run:
types: [completed]
permissions:
contents: read
pull-requests: write
checks: read
jobs:
auto-approve:
runs-on: ubuntu-latest
name: Auto Approve PRs
steps:
- uses: bfra-me/github-app@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
# Optional: path to config file
config-path: .github/auto-approve.yml
You can deploy this app as a GitHub App on platforms like Vercel:
-
Create a GitHub App in your organization or account
-
Set the required permissions:
- Pull requests: Read & Write
- Checks: Read
- Repository contents: Read
- Repository metadata: Read
-
Subscribe to the webhook events:
- Pull request
- Pull request review
- Check run
-
Deploy to a serverless platform like Vercel:
# Install Vercel CLI npm i -g vercel # Deploy vercel
-
Set the webhook URL to your deployment URL
# Install dependencies
pnpm install
# Run in development mode
pnpm run dev
# Build
pnpm run build
# Run tests
pnpm test
# Type checking
pnpm run typecheck
# Linting
pnpm run lint
# Format code
pnpm run format