Goal
- •Create a draft PR for the current branch with a clear title/body and test notes.
Inputs (ask only if missing)
- •Target base branch (if not default).
- •Issue reference (if any).
- •Whether to make it draft (default: draft).
Preconditions
- •
ghis installed and authenticated. - •Must be on a feature branch (not default).
Non-goals / Guardrails
- •Do not push or create PRs without user approval when approvals are required.
- •Do not include secrets in PR body.
Steps
- •Validate auth + repo
- •
gh auth status - •
gh repo view - •If not authenticated: ask the user to run
gh auth loginand stop.
- •Determine base branch
- •If user specifies, use it.
- •Otherwise detect default:
- •
gh repo view --json defaultBranchRef -q .defaultBranchRef.name
- •
- •Ensure branch is pushed
- •If upstream missing:
git push -u origin HEAD.
- •Compose PR title/body
- •Title: use latest commit subject unless unclear.
- •Body must include:
- •Summary (1–3 bullets)
- •Key changes (bullets)
- •How to test (exact commands)
- •Risks/notes (optional)
- •Issue links (e.g. "Fixes #123") if provided
- •If a PR template exists, prefer it and fill required sections:
- •Check for
.github/PULL_REQUEST_TEMPLATE*or.github/pull_request_template*.
- •Check for
- •Create PR (draft by default)
- •
gh pr create --draft --base <base> --title "<title>" --body "<body>" - •If using a template: add
--template <template>.
Output format
- •PR URL (from gh output).
- •Base branch and draft/non-draft status.
- •Summary of what went into the PR body.
Edge cases
- •If the branch is ahead but not pushed, push first.
- •If there are uncommitted changes, warn and confirm before PR creation.
Trigger examples
- •"PR作って"
- •"draft PR を作成して"
- •"gh pr create して"