Create pull requests with proper templates and metadata.
If the branch name contains an issue number (e.g.,
,
), extract it and fetch the issue details:
If no issue number is found in the branch name, skip this step.
Always use this exact format when linking issues in a PR body. Replace the
repo's
template section with a
section:
This format ensures GitHub renders rich issue links (with title, status, etc.)
automatically. Do not append the issue title after the number — GitHub
handles that via its rich formatting.
-
Ensure pre-commit checks pass (lint, test, Docker if applicable)
-
Push the branch to remote
-
Detect associated issue from branch name (see above)
-
Read the repo's PR template: look for
.github/PULL_REQUEST_TEMPLATE.md
-
Fill in the PR template with actual content:
- Summary: Concise description of what the PR does and why
- Type: Check the matching type checkbox (feat, fix, test, etc.)
- Changes Made: Bullet list of specific changes
- Closes: Replace with section
using the issue link format specified above
- Testing: Check boxes for tests that were added/run
- Quality Checks: Check boxes for lint/format/build that passed
- Checklist: Check all applicable items
- Leave sections like Breaking Changes, Screenshots, Deployment Notes
with their placeholder comments if not applicable
-
Create the PR:
bash
gh pr create --title "<title>" --body "<filled template>"
Use a HEREDOC for the body to preserve formatting.
Important: Do NOT use
— it only uses the commit
message and skips the PR template entirely. Always read and fill the template.