Automatically generates detailed PR descriptions from your diffs using Claude AI. No more empty PR descriptions.
# .github/workflows/pr-description.yml
name: AI PR Description
on:
pull_request:
types: [opened]
permissions:
contents: read
pull-requests: write
jobs:
describe:
runs-on: ubuntu-latest
steps:
- uses: avatrix1/ai-pr-description@v1
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}When a PR is opened without a description (or with less than 100 characters), this action:
- Reads the diff and file changes
- Sends them to Claude AI
- Updates the PR with a structured description containing:
- Summary — what the PR does and why
- Changes — key changes grouped by area
- Testing — how to verify the changes
If the PR already has a description longer than 100 characters, the action skips to avoid overwriting manually written descriptions.
| Input | Description | Required | Default |
|---|---|---|---|
anthropic_api_key |
Your Anthropic API key | Yes | — |
github_token |
GitHub token for updating the PR | No | ${{ github.token }} |
model |
Claude model to use | No | claude-sonnet-4-20250514 |
max_diff_size |
Max diff size in chars sent to Claude | No | 50000 |
## Summary
Adds rate limiting to the API endpoint to prevent abuse. Implements a per-key
counter with configurable limits and proper HTTP 429 responses.
## Changes
- Add in-memory usage tracking per API key
- Return X-RateLimit headers on all responses
- Add 429 response when limit exceeded
## Testing
Send repeated requests to the API endpoint and verify the rate limit headers
decrement correctly. After hitting the limit, confirm a 429 response is returned.MIT