name: oxgh:issue description: Create GitHub Issue
Context
First, run these commands and review their output:
- Current repo:
gh repo view --json nameWithOwner --jq '.nameWithOwner'
Issue types
Issue types (Bug, Feature, Task) are NOT labels - they're a separate GitHub feature. The gh CLI doesn't support them directly yet, so use the REST API:
gh api -X PATCH repos/{owner}/{repo}/issues/{number} --field type=Bug
Valid types: Bug, Feature, Task
Linking as a subissue
To make an issue a subissue of a parent, get the numeric ID (not the issue number) and POST it:
gh api repos/{owner}/{repo}/issues/{child_number} --jq '.id'
# Returns: 3860943964
echo '{"sub_issue_id": 3860943964}' | gh api -X POST repos/{owner}/{repo}/issues/{parent_number}/sub_issues --input -
The sub_issues endpoint requires the numeric ID as an integer in JSON, hence piping through --input -.
Inheriting from parent issue
When creating a subissue, it should have the same milestone and project triage as its parent.
Get parent issue milestone
gh api repos/{owner}/{repo}/issues/{parent_number} --jq '.milestone.number // empty'
Get parent issue project fields
First get the parent's project item ID:
gh project item-list {project_number} --owner {owner} --limit 300 --format json | jq '.items[] | select(.content.number == PARENT_NUMBER) | {id, component: .component, priority: .priority, size: .size}'
Set milestone on new issue
gh api -X PATCH repos/{owner}/{repo}/issues/{number} --field milestone={milestone-number}
Set project fields on new issue
First get the new issue's project item ID (issue must be added to project first):
gh project item-list {project_number} --owner {owner} --limit 300 --format json | jq '.items[] | select(.content.number == NEW_ISSUE_NUMBER) | .id'
Then copy each field using the option IDs from context:
gh project item-edit --id {item-id} --project-id {project-id} --field-id {field-id} --single-select-option-id {option-id}
Your task
Based on the user's request:
- If a parent issue was specified, fetch its milestone and project fields first
- Create the issue with
gh issue create --title "..." --body "..." - Set the issue type using the API
- If a parent issue was specified:
- Link it as a subissue
- Copy the parent's milestone (if set)
- Copy the parent's project triage (component, priority, size)
- Execute each step as a separate command. Do NOT chain commands with && or ;. Do not send any other text or messages besides these tool calls.