name: draft-pr description: Draft a pull request with Jira linking from the branch name disable-model-invocation: true
Draft a pull request for the current branch.
Instructions
- Run
git branch --show-currentto get the current branch name. - Extract the Jira ticket key if present (pattern: uppercase letters + hyphen + digits, e.g., INFRA-370, ENG-123). The ticket may appear anywhere in the branch name.
- Determine the base branch — use
mainunless the user specifies otherwise via $ARGUMENTS. - Run
git logandgit diffagainst the base branch to understand ALL changes (not just the latest commit). - Check if the branch has been pushed to the remote. If not, ask before pushing.
- Draft the PR:
- Title: Must follow conventional commits format:
type(context): [JIRA] description- Determine the
typeby reviewing ALL commits on the branch and bubbling up to a single conventional commit type (e.g., if commits includefeatandfix, usefeatsince it's the higher-level change) - Common types:
feat,fix,refactor,docs,test,ci,chore,build,perf contextis the area/scope of the change (e.g.,workflows,actions,deploy)[JIRA]is the Jira ticket key in brackets if found (e.g.,[INFRA-370])- Keep under 70 characters total
- Examples:
feat(workflows): [INFRA-370] add artifacts-cicd integration tests,fix(deploy): [ENG-123] correct artifact routing logic
- Determine the
- Body using this structure:
- Title: Must follow conventional commits format:
## Summary
<1-3 bullet points summarizing what changed and why>
## Jira
<link to ticket if found, otherwise omit this section>
## Changes
<Bulleted list of specific changes, grouped by area if needed>
## Test plan
<How to verify these changes — mention any tests added/run>
Generate a Changes Breakdown table by file type. Categorize each changed file and sum additions/deletions:
gh api repos/{owner}/{repo}/pulls/{number}/files --paginate \ --jq '.[] | "\(.filename)\t\(.additions)\t\(.deletions)"'Categorize by extension:
.yaml/.yml→ YAML (workflows),.bats→ Bats (tests),.sh→ Shell scripts,.md→ Markdown/Docs, etc. Present as a table:## Changes Breakdown | Category | +add | -del | net | files | | ------------ | -------- | ------- | --------- | ------ | | Bats (tests) | 698 | 0 | +698 | 3 | | ... | ... | ... | ... | ... | | **Total** | **1512** | **286** | **+1226** | **22** |Add a brief note explaining the largest categories (e.g., "Shell script churn is mostly linter reformatting").
Present the draft to the user for review before creating the PR.
Create using
gh pr create.
Jira URL
Construct Jira links as: https://aerospike.atlassian.net/browse/{TICKET_KEY}
User arguments
If the user provides arguments, treat them as additional context about the PR (e.g., base branch, extra description, or ticket details). $ARGUMENTS