This project is a webhook bot that automatically enriches GitHub Pull Requests with descriptions. When a PR is opened, the bot automatically analyzes commit messages and code changes, using an LLM (Groq) to generate a professional PR description.
Live deployed at https://deeployed-case-latest.onrender.com, go to the link and make sure the server is not sleeping (Render free tier) then open PR to https://github.com/egeyardimci/deeployed-case-test and try!
Sample PR: egeyardimci/pr-description-bot-test-repo#3
- Automatically triggers when a GitHub Pull Request is opened
- Analyzes commit messages and diffs
- Generates professional PR descriptions using Groq LLM API
- Works as a GitHub App providing secure integration
- Easy deployment with Docker support
- Bun v1.3.1 or higher
- GitHub App credentials
- Groq API key
- (Optional) Docker - for running as a container
git clone <repo-url>
cd deeployed-casebun install- Go to Settings > Developer settings > GitHub Apps in your GitHub account
- Click the "New GitHub App" button
- Configure the following settings:
General Settings:
- GitHub App name: Choose a unique name (e.g.,
pr-description-bot-yourname) - Homepage URL:
http://localhost:3000(or your production URL) - Webhook URL: Enter your Smee.io URL (you'll create this in the next step)
- Webhook secret: (optional) Set a webhook secret
Permissions:
- Repository permissions:
Pull requests: Read & WriteContents: ReadMetadata: Read
Subscribe to events:
- Select the
Pull requestevent
- Click the "Create GitHub App" button
- After the app is created:
- Note the App ID
- Click "Generate a private key" to download the private key
- Save the private key file (
*.pem) to the project root directory asprivate-key.pem
- Go to the "Install App" tab on your GitHub App page
- Select the account/organization you want to test with
- Grant access to all repositories or selected repositories
- Click the "Install" button
- Go to Groq Console
- Create an account/sign in
- Create a new API key from the API Keys section
- Copy the API key
Copy the .env.example file to .env:
cp .env.example .envEdit the .env file:
GITHUB_APP_ID=123456 # Your GitHub App ID
GITHUB_PRIVATE_KEY_PATH=./private-key.pem # Private key file path
GROQ_API_KEY=your-groq-api-key-here # Your Groq API key
SMEE_URL=your-smee-url # Your SMEE URLbun run index.jsThe server will start at http://localhost:3000.
- Make sure your
.envfile is configured with all required variables - Ensure your
private-key.pemfile is in the project root - Run with Docker Compose:
docker-compose up -dTo view logs:
docker-compose logs -fTo stop the container:
docker-compose down- Build the Docker image:
docker build -t pr-description-bot .- Run the container:
Linux/Mac:
docker run -p 3000:3000 \
-e GITHUB_APP_ID=your_app_id \
-e GITHUB_PRIVATE_KEY_PATH=./private-key.pem \
-e GROQ_API_KEY=your_groq_api_key \
-e SMEE_URL=your_smee_url \
-v $(pwd)/private-key.pem:/app/private-key.pem \
pr-description-botWindows PowerShell:
docker run -d `
-e GITHUB_APP_ID=your_app_id `
-e GITHUB_PRIVATE_KEY_PATH=./private-key.pem `
-e GROQ_API_KEY=your_groq_api_key `
-e SMEE_URL=your_smee_url `
-v ${PWD}/private-key.pem:/app/private-key.pem `
pr-description-botNote: When running with Docker, don't forget to mount the private key file as a volume.
You need to use Smee.io to forward GitHub webhooks to your local development environment.
- Go to https://smee.io
- Click the "Start a new channel" button
- Copy the URL provided (e.g.,
https://smee.io/abc123xyz)
npm install -g smee-client
# Run the Smee client
smee --url https://smee.io/YOUR_SMEE_URL --path /webhook --port 3000This command will forward webhook requests from Smee.io to http://localhost:3000/webhook.
- Return to your GitHub App settings
- Enter your Smee.io URL in the "Webhook URL" field
- Click the "Save changes" button
- Create a new branch in a repository where you installed the app
- Make some changes and commit
- Open a new Pull Request
- The bot will automatically update the PR description
You'll see these messages in the console logs:
Server running at http://localhost:3000
Webhook received: PR opened
PR description updated successfully
To test the project:
# Run all tests
bun test
# Test in watch mode
bun run test:watch
# Test with coverage report
bun run test:coverageFor detailed information about the test suite, test structure, and writing new tests, see the Tests Documentation.
deeployed-case/
├── index.js # Main application entry point
├── constants.js # Constants and system prompts
├── routes/
│ └── webhookRoute.js # Webhook endpoint route
├── services/
│ ├── webhookService.js # Webhook business logic
│ ├── prDescriptionService.js # PR description generation
│ ├── githubAPIService.js # GitHub API calls
│ └── llmService.js # Groq LLM integration
├── tests/
│ └── unit/ # Unit tests
├── .env # Environment variables (not in git)
├── .env.example # Example environment variables
├── private-key.pem # GitHub App private key (not in git)
├── Dockerfile # Docker container definition
└── package.json # Project dependencies
- When a Pull Request is opened, GitHub triggers a webhook
- The bot retrieves the PR's commit messages and diff
- It sends this information to Groq LLM to generate a professional description
- The generated description is written to the PR using the GitHub API
- Runtime: Bun (fast JavaScript runtime)
- Framework: Express.js
- GitHub Integration: Octokit (GitHub REST API v3)
- LLM Provider: Groq (llama-3.3-70b-versatile model)
- Authentication: GitHub App installation tokens
- Make sure the
private-key.pemfile is in the project root directory - Check that the
GITHUB_PRIVATE_KEY_PATHin the.envfile is correct
- Make sure your GitHub App ID is correct
- Verify that the private key file belongs to the correct GitHub App
- Ensure the GitHub App is installed on the relevant repository
- Make sure the Smee client is running
- Verify that the GitHub App webhook URL is your Smee.io URL
- Ensure the GitHub App is subscribed to the "Pull request" event
- Make sure the bot application is running (
http://localhost:3000)
- Make sure your Groq API key is valid
- Check your internet connection
- Check Groq API limits (rate limiting)
This project was developed for educational purposes.