PR Reviewer is a GitHub Actions toolkit that performs automated pull request reviews using Gemini and LangGraph.
Unlike traditional linters or generic AI reviewers, PR Reviewer learns how your team reviews code and applies those standards automatically to future pull requests.
The system consists of three workflows:
| Workflow | Purpose |
|---|---|
| G1 — Pattern Learner | Learns your team's review standards from historical PRs |
| G2 — PR Reviewer | Reviews new pull requests using those standards |
| G3 — Fix Verifier | Checks whether review comments were actually addressed |
The workflows are designed to work together:
Historical PRs
↓
G1 Pattern Learner
↓
team_patterns.json
team_tone.json
↓
G2 PR Reviewer
↓
Review Comments
↓
Developer Fixes Issues
↓
G3 Fix Verifier
No database is required. All learned patterns are stored directly in your repository.
Most AI code reviewers provide generic feedback.
Real engineering teams have their own standards. Some teams:
- require explicit timeout handling.
- care heavily about authorization checks.
- enforce strict naming conventions.
- intentionally ignore certain stylistic issues.
PR Reviewer learns these team-specific preferences from real review comments and uses them when reviewing future pull requests.
The goal is to make automated reviews feel like they came from one of your senior engineers.
G1 analyses historical pull requests and extracts:
- Reusable review patterns
- Team-specific coding standards
- Reviewer preferences
- Comment tone and style
- Things your team consistently ignores
Optionally, you can give usernames of senior reviewers so the tonality of the pr review comments posted matches the standard practice followed in your team. Examples:
Learns:
- "All external API calls must define timeouts."
- "Database writes should always be wrapped in transactions."
- "Authorization checks must occur before service calls."
Does not learn:
- One-off comments specific to a single PR.
The extracted knowledge is stored in:
.github/pattern_store/team_patterns.json
.github/pattern_store/team_tone.json
.github/pattern_store/team_config.json
It is preferrable to run G1 before using G2. Consumes only one Gemini API request.
G2 can review automatically whenever a PR is opened or updated, or manually on demand.
Three specialist reviewers run in parallel:
- Security Reviewer
- Logic Reviewer
- Style Reviewer
Each reviewer:
- Analyses the PR diff
- Applies team patterns learned by G1
- Generates structured review comments
- Posts comments directly on the pull request
Comments include:
- Severity
- Category
- Explanation
- Suggested fix
G3 verifies whether review comments have actually been addressed. If yes, it posts a proper response to the comment explaining the fix that was applied. This slashes the manual work to half: apply the fixes (whether manually or using github mcp server), commit, and let the bot handle the communication on github.
It:
-
Reads existing review comments
-
Compares them against the latest PR diff
-
Determines whether each issue is:
- Resolved
- Partially Resolved
- Unresolved
-
Posts a reply for the resolved comments, explaining the result
This helps reviewers avoid manually checking every requested change.
On running G2 and G3, the following directories are generated; you can add these to .gitignore as they are for your reference and don't need to be committed in you repo:
- resolver_documents
- contains Verification Documents
- inline comments that were left by the pr-reviewer bot on a pull request
- .txt file containing structured metadata of each of the comment for bot's reference
- reviewer_summaries
- structured summary of the comments posted by the bot along with it's metadata
- used by the bot to post comments
- resolver_responses
- metadata generated by G3
- contains comment_id, status (resolved/unresolved), and the reply posted by the bot
Copy the enitre .github directory from this repository into your project. After copying, your repository should contain:
.github/
├── workflows/
│ ├── g1_pattern_learner.yml
│ ├── g2_pr_reviewer.yml
│ └── g3_fix_verifier.yml
│
├── src/
│ ├── g1_pattern_learner.py
│ ├── g2_pr_reviewer.py
│ └── g3_fix_verifier.py
│
└── pattern_store/
| ├── team_patterns.json
| ├── team_tone.json
| └── team_config.json
└── requirements.txt
commit this in the main branch of your repo.
Open:
Repository → Settings → Secrets and Variables → Actions
Create the following secrets.
Create an API key from:
Store it as:
GEMINI_API_KEY
Create a GitHub Personal Access Token.
Recommended permissions:
Contents: Read and Write
Pull Requests: Read and Write
Metadata: Read
Store it as:
GH_TOKEN
Open:
Repository → Actions
You should see:
- G1 — Learn Team Patterns
- G2 — Automated PR Review
- G3 — Verify PR Fixes
If they appear, installation is complete.
Before reviewing pull requests, teach the system how your team reviews code.
Run G1 once using several historical pull requests.
Choose PRs that contain meaningful review discussions.
-
Open GitHub.
-
Go to Actions.
-
Select:
- G1 — Learn Team Patterns
-
Click:
- Run Workflow
Provide:
Comma-separated list of historical PRs.
Example:
12,18,27,31,42
Optional.
Comma-separated GitHub usernames.
Example:
alice,bob
These reviewers receive additional weight during pattern extraction.
Click:
Run Workflow
When complete, the workflow automatically updates:
team_patterns.json
team_tone.json
team_config.json
and commits them back into your repository.
G2 automatically runs whenever:
- A pull request is opened
- New commits are pushed to a pull request
No manual action is required.
- Actions
- G2 — Automated PR Review
- Run Workflow
- Enter PR Number
- Run
Review comments will appear directly on the pull request.
After the author addresses review comments:
-
Open Actions
-
Select:
- G3 — Verify PR Fixes
-
Run Workflow
Provide:
The PR to verify.
If enabled, G3 confirms resolved issues.
If enabled, G3 notifies developers about remaining issues.
The workflow replies directly within each review thread.
A typical team workflow looks like:
Run G1 once
↓
Developer opens PR
↓
G2 reviews PR automatically
↓
Developer fixes issues
↓
Run G3
↓
Reviewer confirms changes and posts replies.
Re-run G1 periodically as your team's standards evolve.
Possible causes:
- G1 has never been run
- team_patterns.json is empty
- pattern store files were not committed
Run G1 using at least one historical PR.
Verify that:
- GH_TOKEN has write access
- Actions are enabled
- The token can access the repository
G2 was executed multiple times on the same PR.
Remove duplicate comments manually from the pull request. (intended future fix)
No external database is used.
All learned patterns, review tone, and reviewer configuration are stored directly in your repository under:
.github/pattern_store/
This makes the system easy to audit, version, and reset using normal Git workflows.