This project is a hackathon idea for an AI agent that analyzes a PR and determines if it should be auto-closed. If it should be, it generates a comment, adds the comment, and then closes the PR.
The use case is focused on training and tutorial repos where students often submit their work back to the repo. But, to ensure the training works for the next student, we can't accept the submission. This helps automate the handling of those PRs.
The app uses the Mastra AI framework and works by using the following:
- GitHub webhook - a webhook is triggered for any PR related events. The app only cares about PRs being opened or reopened.
- PR Analyzer - this agent looks at the details of the PR to determine if the PR should be automatically closed
- Comment generator - this agent will generate a comment, using details from the PR and why it's being closed. It's careful to educate, but still motivate.
- PR Executor - this agent adds the comment and then closes the PR
- MCP Gateway - the Docker MCP Gateway that provides the GitHub Official MCP server and provides only the tools needed for this app
And it's all packaged in the compose.yaml file!
You will need Docker Desktop 4.43.1+. That's it!
-
Clone this repo
git clone https://github.com/mikesir87/hackathon-july-2025.git cd hackathon-july-2025
-
Create a
.envfile, using the.env.samplefile as a template:cp .env.sample .env -
Add a GitHub personal access token in the newly created
.envfile. -
Start the app using Docker Compose!
docker compose upIt may take a little while to download the models. Or, use Docker Offload to make things faster 😉
-
Make a pull request against the mikesir87/temp-training-demo repo
- I'll provide further instructions on how to tweak things to use your own repo in the future. Just ran out of time before the hackathon presentations!
-
Watch the PR be analyzed!
