RepoPilot is a local-first CLI that reviews an existing GitHub pull request or GitLab merge request by:
- Fetching the PR/MR metadata and file diffs from the hosting API
- Asking an OpenAI model to analyze the change set
- Rendering a structured markdown review
- Optionally posting that review back to the PR/MR
It can run locally first, as a reusable GitHub Action on pull_request events, or inside GitLab CI merge request pipelines.
- Python 3.10+
OPENAI_API_KEYGITHUB_TOKENfor GitHubGITLAB_TOKENfor GitLab
The GitHub token needs permission to read pull requests and, if you post the result, write issue comments. The GitLab token needs access to read merge requests and write merge request notes.
python3 -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"Preview a review locally:
repopilot review \
--pr-url https://github.com/OWNER/REPO/pull/123 \
--model gpt-4.1Post the generated review to the pull request:
repopilot review \
--pr-url https://github.com/OWNER/REPO/pull/123 \
--model gpt-4.1 \
--postYou can also pass the repository and pull request number explicitly:
repopilot review \
--repo OWNER/REPO \
--pr-number 123 \
--model gpt-4.1Review a GitLab merge request locally:
repopilot review \
--gitlab-mr-url https://gitlab.com/GROUP/PROJECT/-/merge_requests/123 \
--model gpt-5.2Post the generated review to a GitLab merge request:
repopilot review \
--gitlab-project GROUP/PROJECT \
--gitlab-mr-iid 123 \
--model gpt-5.2 \
--postInside GitHub Actions, RepoPilot can derive the PR directly from the event payload:
repopilot review --from-github-event --model gpt-5.2 --postInside GitLab CI, RepoPilot can derive the MR directly from predefined CI variables:
repopilot review --from-gitlab-ci --model gpt-5.2 --postRepoPilot ships as a composite GitHub Action via action.yml.
For consumers, prefer a version tag instead of @main.
Minimal workflow:
name: RepoPilot
on:
pull_request:
types: [opened, synchronize, reopened]
permissions:
contents: read
pull-requests: write
issues: write
jobs:
review:
runs-on: ubuntu-latest
steps:
- uses: saadmhd07/RepoPilot@v0.1.0
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
openai-api-key: ${{ secrets.OPENAI_API_KEY }}
model: gpt-5.2A ready-to-copy example also lives in examples/review.yml.
Required repository secret:
OPENAI_API_KEY
Notes:
secrets.GITHUB_TOKENis enough if the workflow haspull-requests: writeandissues: write- the action reads the PR from
GITHUB_EVENT_PATH, so no PR URL input is needed in CI - pinning to
@v0.1.0avoids drift from future changes onmain - if
OPENAI_API_KEYis missing, the action skips cleanly with a warning instead of failing obscurely
Add OPENAI_API_KEY and GITLAB_TOKEN as CI/CD variables, then add a merge request pipeline job:
repopilot_review:
image: python:3.11-slim
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
variables:
PIP_DISABLE_PIP_VERSION_CHECK: "1"
before_script:
- python -m pip install git+https://github.com/saadmhd07/RepoPilot.git@main
script:
- repopilot review --from-gitlab-ci --model gpt-5.2 --postA ready-to-copy example also lives in examples/gitlab-ci.yml.
Once GitLab support is released, pin this install URL to the release tag instead of @main.
Optional overrides:
REPOPILOT_GITHUB_API_URL: defaults tohttps://api.github.comREPOPILOT_GITLAB_API_URL: defaults tohttps://gitlab.com/api/v4REPOPILOT_MAX_FILES: defaults to40REPOPILOT_MAX_PATCH_CHARS: defaults to12000REPOPILOT_MAX_TOTAL_CHARS: defaults to45000
src/repopilot/github.py: GitHub API integrationsrc/repopilot/gitlab.py: GitLab API integrationsrc/repopilot/llm.py: OpenAI review enginesrc/repopilot/prompts/: review prompts kept separate from application logicsrc/repopilot/render.py: markdown renderingsrc/repopilot/cli.py: local CLI entrypoint
- This first version posts a single PR-level comment, not inline review comments.
- Large pull requests are truncated before being sent to the model.
- Re-running the action updates the existing RepoPilot comment instead of posting duplicates.
To publish the first reusable action version:
git add action.yml README.md examples/review.yml
git commit -m "Prepare RepoPilot v0.1.0 release"
git push origin main
git tag -a v0.1.0 -m "RepoPilot v0.1.0"
git push origin v0.1.0Then consumers should reference:
uses: saadmhd07/RepoPilot@v0.1.0