Serverless GitHub App that auto-approves pull requests after CI passes, with optional AI code review via Amazon Bedrock. Four repositories: Node.js/Probot app, AWS Terraform module (Lambda + API Gateway + Secrets Manager), GitHub Terraform module (webhooks), and deployment infra.
A serverless GitHub App that auto-approves pull requests when all CI checks pass. Optionally, before approving, it sends the diff to Amazon Bedrock for an AI code review that detects bugs, security vulnerabilities, and performance issues.
The project is split into four repositories with clear responsibilities:
| Repository | Version | Role |
|---|---|---|
| pr-auto-approver | v1.0.0 | Node.js/Probot app — business logic |
| terraform-aws-pr-auto-approver | v1.2.0 | Terraform AWS module — Lambda, API Gateway, Secrets Manager |
| terraform-github-pr-auto-approver | v1.0.0 | Terraform GitHub module — per-repo webhooks |
| pr-auto-approver-infra | latest | Private deployment — consumes the modules, branch protected |

The screenshot shows the full flow in the test repository: the owner comments on the Secrets Manager integration, the bot auto-approves with "All checks passed. Auto-approved by pr-auto-approver bot.", and the PR is merged — all in under a minute.
The full flow from PR creation to approval:
Secrets management follows the principle of least privilege:
secretsmanager:GetSecretValue permissions only for the specific ARNsbedrock:InvokeModel) are added only when bedrock_enabled = trueThe terraform-aws-pr-auto-approver v1.2.0 module creates:
| Resource | Configuration |
|---|---|
| Lambda | Node.js 20, 128 MB / 30s (no Bedrock), 256 MB / 120s (with Bedrock) |
| API Gateway v2 | HTTP API with POST route |
| Secrets Manager | 2 secrets (private key + webhook secret) |
| IAM Role | Least-privilege, conditional Bedrock |
| CloudWatch Logs | 14-day retention |
| CloudWatch Dashboard | Lambda, API GW, Bedrock metrics (optional) |
| CloudWatch Alarms | Errors, throttles, high duration, 5xx |
| SNS Topic | Email alerts (optional) |
| AWS Budget | Monthly Bedrock budget (optional) |
The terraform-github-pr-auto-approver v1.0.0 module configures webhooks on each specified repository:
module "approver_github" {
source = "jonmatum/pr-auto-approver/github"
version = "~> 1.0"
webhook_url = module.approver_infra.webhook_url
webhook_secret = var.webhook_secret
github_repositories = ["repo-one", "repo-two"]
}It subscribes each repository to pull_request and check_suite events, pointing to the API Gateway endpoint.

When bedrock_enabled = true, Lambda sends the PR diff to Claude 3 Haiku (configurable) before approving. In the screenshot, the bot detected 3 issues in intentionally vulnerable code — including a SQL injection from directly concatenating req.query.id — and requested changes instead of approving. The model reviews for:
If Bedrock is disabled or fails, the bot falls back to auto-approve after CI passes — the AI review never blocks the flow.
In teams with AI agents that generate PRs automatically — like the content agent in this knowledge base — the bottleneck shifts from "writing code" to "reviewing and approving PRs." This bot eliminates the manual wait for PRs from trusted authors that already passed CI, while the optional Bedrock layer adds a code review safety net without human intervention.
GitHub's native CI/CD platform. Declarative YAML workflows that automate build, test, deploy, and any development lifecycle task — directly from the repository.
HashiCorp's Infrastructure as Code tool that enables defining, provisioning, and managing multi-cloud infrastructure through declarative HCL files.
AWS serverless compute service that runs code in response to events without provisioning or managing servers, automatically scaling from zero to thousands of concurrent executions.
AWS managed service for creating, publishing, and managing REST, HTTP, and WebSocket APIs that act as entry points to Lambda functions and other backend services.
Practices and tools for securely storing, distributing, and rotating credentials, API keys, and other sensitive data in applications and pipelines.
Cloud computing model where the provider manages infrastructure automatically, allowing code execution without provisioning or managing servers, paying only for actual usage.
Practice of defining and managing infrastructure through versioned configuration files instead of manual processes. Foundation of modern operations automation.
Continuous Integration and Continuous Delivery/Deployment — practices that automate code integration, testing, and delivery to production. Foundation of modern software engineering.