AI-Generated PR Description
How OpenCode fills your pull request template from the issue and branch diff
AI-Generated PR Description
When ai-pull-request-description is true and OpenCode is configured (opencode-server-url, opencode-model), the action can generate or update the pull request description automatically using the OpenCode Plan agent.
How it works
- The action determines the PR's base and head branch (target and source branch).
- The OpenCode Plan agent runs in the repository workspace. It:
- Reads the repository's pull request template (see below).
- Computes the diff between base and head (e.g.
git diff base..head) to understand what changed. - Uses the issue description (from the issue linked to the PR branch) as context.
- The agent fills the template with a structured description: summary, scope of changes, technical details, how to test, breaking changes, deployment notes, etc., following the same sections and format as your template.
- The action writes the result to the PR body (prefixed with the issue number for reference).
No pre-computed file list or patches are sent from the action; the agent has access to the workspace and computes the diff itself, similar to the check progress flow.
PR template as example for the AI
The AI is instructed to use your repository's pull request template as the structure for the description. You should define:
.github/pull_request_template.md— This file is read by the OpenCode agent and used as the skeleton to fill. The agent keeps the same headings, bullet lists, checkboxes (- [ ],- [x]), and separators, and fills each section with content derived from the diff and the issue.
If you don't have a template, the agent will still produce a structured description, but defining a template ensures consistent, professional PR descriptions that match your team's expectations (e.g. Summary, Related Issues, Scope of Changes, Technical Details, How to Test, Breaking Changes, Deployment Notes, etc.).
Recommendation: Add a .github/pull_request_template.md in your repo with the sections you want (summary, scope, testing, breaking changes, etc.). The AI will use it as a guide and fill it with the information from the issue and the branch diff.
When the AI description runs
- The PR must have an issue linked (branch name follows the pattern that includes the issue number, e.g.
feature/123-add-feature). - The linked issue must have a non-empty description (used as context).
- If
ai-members-onlyis enabled (default: false), the PR author must be a project/org member; otherwise the step is skipped. - The action runs on the same
pull_requestevents as the rest of the PR pipeline (e.g. opened, edited).
Enable in your workflow
Set ai-pull-request-description: true and configure OpenCode in your workflow:
- uses: vypdev/copilot@master
with:
token: ${{ secrets.PAT }}
project-ids: '2,3'
ai-pull-request-description: true
opencode-server-url: ${{ secrets.OPENCODE_SERVER_URL }}
opencode-model: 'anthropic/claude-3-5-sonnet'
See OpenCode (AI) for provider setup and Configuration for all AI-related inputs.