Automatically generate descriptions for pull requests using any OpenAI-compatible AI model (ChatGPT, DeepSeek, Groq, Ollama, etc.).
When you open or update a pull request labeled with "ai-describe", this action will automatically generate a concise list of changes and update the pull request description (body) or post a comment.
- High-Performance: Uses pre-built binaries for near-instant startup (no Docker build overhead).
- Multi-Model Support: Works with OpenAI, DeepSeek, Groq, or any OpenAI-compatible API.
- API key from your chosen AI provider (OpenAI, DeepSeek, etc.).
Add the label ai-describe to any pull request to trigger generation.
Enable auto-update-enabled: true to automatically generate and update the PR description every time new commits are pushed, no labels required. The description will always stay up to date with the latest changes.
Add the following workflow file to your repository in .github/workflows/ai-pr-describer.yml:
name: AI Pull Request Describer
on:
pull_request_target:
types: [opened, synchronize, labeled, reopened]
jobs:
describe:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: AI Pull Request Describer
uses: fajarhide/ai-pr-describer@v1.1.2 # Use the latest released version for best performance
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
github-api-base-url: 'https://api.github.com'
openai-api-key: ${{ secrets.OPENAI_API_KEY }}
openai-model: '${{ secrets.OPENAI_MODEL }}'
openai-base-url: '${{ secrets.OPENAI_BASE_URL }}'
max-tokens: 2000
max-context-tokens: 256000
auto-update-enabled: falseopenai-model: 'gpt-4o'openai-api-key: ${{ secrets.OPENAI_API_KEY }}
openai-model: 'deepseek-chat'
openai-base-url: 'https://api.deepseek.com'openai-api-key: ${{ secrets.OPENAI_API_KEY }}
openai-model: 'llama3-8b-8192'
openai-base-url: 'https://api.groq.com/openai/v1'openai-api-key: ${{ secrets.OPENAI_API_KEY }}
openai-model: 'glm-4'
openai-base-url: 'https://open.bigmodel.cn/api/paas/v4'
max-context-tokens: 128000 # adjust based on model capabilityopenai-api-key: 'ollama' # usually not required but cannot be empty
openai-model: 'llama3'
openai-base-url: 'http://your-ollama-host:11434/v1'flowchart LR
A[PR Event Occurs] --> B{auto-update-enabled ?}
B -->|No| C{Has ai-describe label?}
B -->|Yes| D[✅ Run Automatically]
C -->|No| E[Skip / Do Nothing]
C -->|Yes| D
D --> F[Fetch full PR diff]
F --> G[AI generates complete description]
G --> H[Update PR body]
style D fill:#0ea5e9,color:white
style H fill:#10b981,color:white
Supported events:
opened- when PR is first createdsynchronize- every time new commits are pushedlabeled- whenai-describelabel is addedreopened- when PR is reopened
| Name | Required | Description | Default |
|---|---|---|---|
github-token |
✅ Yes | GitHub API token, use ${{ secrets.GITHUB_TOKEN }} |
|
openai-api-key |
✅ Yes | API Key for your AI provider (OpenAI, DeepSeek, Groq, etc.) | |
openai-model |
❌ No | AI model to use | gpt-3.5-turbo |
openai-base-url |
❌ No | Custom base URL for OpenAI-compatible APIs | |
max-tokens |
❌ No | Maximum output tokens for generated description | 2000 |
max-context-tokens |
❌ No | Maximum total context tokens (input diff + prompt + output) | 32000 |
auto-update-enabled |
❌ No | Auto update PR description on every new commit. No labels required. | false |
This action is now a Composite Action using pre-built binaries. It typically runs in under 15 seconds, compared to ~2.5 minutes for Docker-based actions.
Important
To use this action in your own fork, you must first create a Release (e.g. v1.0.0) to trigger the build and upload of binaries.
This error occurs when the required secrets are not passed to the action. Ensure you have:
- Created a secret named
OPENAI_API_KEYin your repository settings (Settings > Secrets and variables > Actions). - Passed the secrets in your workflow file as shown in the Usage section.
Note
You do not need to create GITHUB_TOKEN yourself. It is a built-in secret provided automatically by GitHub Actions. You only need to create custom secrets like OPENAI_API_KEY etc.
By default, GitHub does not pass secrets to workflows triggered by pull requests from forked repositories for security reasons. If a contributor from a fork opens a PR, the action will fail with a "Missing required environment variables" error because it cannot access your OPENAI_API_KEY.
To fix this, you can:
- Manually run the action on the PR after it's been opened by a maintainer.
- (Use with caution) Use the
pull_request_targetevent instead ofpull_request, but be aware of the security implications.
Please see CHANGELOG for more information what has changed recently.
Please see CONTRIBUTING for details.
The MIT License (MIT). Please see License File for more information.
