A GitHub Actions–friendly tool that extracts code changes from Python pull requests and sends them to the auto-cepu API for LLM-powered automated code review.
This project is intended to run automatically inside CI (GitHub Actions) and is configured entirely via environment variables (.env), with no CLI arguments.
- Parse GitHub PR diffs to extract added/deleted Python code and corresponding full function definitions.
- Send extracted code sections to the
auto-cepuAPI for analysis. - Designed to run unattended in GitHub Actions.
- No manual arguments — fully configured via
.env.
- GitHub Actions triggers this script on pull request events.
- It reads PR context and credentials from environment variables.
- Fetches the PR diff from the GitHub API.
- Extracts only the changed Python code (added/deleted lines along with their complete function definitions).
- Sends the extracted code to your
auto-cepuAPI endpoint. auto-cepuresponds with LLM-based review feedback (issues, suggestions, severity ratings, duplication analysis, etc.).- The analyzer automatically posts the review feedback as a reply to the pull request.
Before using this tool, make sure:
- Your project uses Python and GitHub Actions.
- You have an
auto-cepuinstance running and accessible.
To enable LLM-powered code review in your repository, add the following job to your GitHub Actions workflow:
name: PR Check
on:
pull_request:
branches: ['*']
workflow_dispatch:
permissions:
contents: read
pull-requests: write
issues: write
jobs:
test:
....
code_review:
name: Code Review
uses: mrrizal/python-pr-analyzer/.github/workflows/pr_analyzer.yml@main
with:
repository: ${{ github.repository }}
pr_number: ${{ github.event.pull_request.number }}
secrets:
token: ${{ secrets.GITHUB_TOKEN }}