Hack Review is a GitHub App that automatically reviews your pull requests. It uses an AI to analyze the changes and provide feedback on potential bugs, style issues, and other problems.
- When a pull request is opened, the app receives a webhook from GitHub.
- The app fetches the files from the pull request.
- The app creates a prompt with the PR title, body, and the diffs of the changed files.
- The app sends the prompt to Hack Club's AI API to get a review.
- The app posts the AI's review as a comment on the pull request.
-
Create a GitHub App:
- Go to your GitHub settings and create a new GitHub App.
- Give it a name, like "Hack Review".
- Set the webhook URL to your server's address, e.g.,
https://your-domain.com/webhook. - Create a webhook secret and save it.
- Give the app the "Pull requests" read and write permission.
- Install the app on the repositories you want it to review.
-
Set up the environment:
- Clone this repository.
- Create a
.envfile and add the following variables:WEBHOOK_SECRET=<your-webhook-secret> APP_ID=<your-app-id> API_KEY=<your-api-key> MODEL=<your-ai-model> BOT_NAME=<name-of-the-app> # For detecting mentions of the bot - Download the private key for your GitHub App and save it as
hack-review.pemin the root of the project.
-
Install the dependencies:
uv sync -
Run the app:
python app.py
The AI's behavior is guided by a system prompt. You can find the system prompt in the data/System_Prompt.md file. You can modify this file to change the AI's behavior.
- Fork the repository.
- Create a new branch.
- Make your changes.
- Open a pull request.