Merge pull request #2596 from gsd-build/fix/issue-type-graphql-2579

fix: use Issue Types via GraphQL, not classification labels
This commit is contained in:
TÂCHES 2026-03-25 22:20:27 -06:00 committed by GitHub
commit 19340ea203
2 changed files with 32 additions and 4 deletions

View file

@ -142,9 +142,10 @@ Then **offer GitHub issue creation**: "Would you like me to create a GitHub issu
If yes, create using the `bash` tool:
```bash
gh issue create --repo gsd-build/gsd-2 \
# Step 1: Create issue (use labels for metadata, NOT for classification — type is set via GraphQL)
ISSUE_URL=$(gh issue create --repo gsd-build/gsd-2 \
--title "..." \
--label "bug" --label "auto-generated" \
--label "auto-generated" \
--body "$(cat <<'EOF'
## Problem
[1-2 sentence summary]
@ -169,7 +170,13 @@ gh issue create --repo gsd-build/gsd-2 \
---
*Auto-generated by `/gsd forensics`*
EOF
)"
)")
# Step 2: Set issue type via GraphQL (gh issue create has no --type flag)
ISSUE_NUM=$(echo "$ISSUE_URL" | grep -oE '[0-9]+$')
ISSUE_ID=$(gh api graphql -f query='{ repository(owner:"gsd-build",name:"gsd-2") { issue(number:'"$ISSUE_NUM"') { id } } }' --jq '.data.repository.issue.id')
TYPE_ID=$(gh api graphql -f query='{ repository(owner:"gsd-build",name:"gsd-2") { issueTypes(first:20) { nodes { id name } } } }' --jq '.data.repository.issueTypes.nodes[] | select(.name=="Bug") | .id')
gh api graphql -f query='mutation { updateIssue(input:{id:"'"$ISSUE_ID"'",issueTypeId:"'"$TYPE_ID"'"}) { issue { number } } }'
```
### Redaction Rules (CRITICAL)

View file

@ -103,9 +103,12 @@ gh issue list -R gsd-build/gsd-2
gh issue list -R gsd-build/gsd-2 --label "priority:p1" --state open
# Create issue with labels and milestone
# NOTE: Do NOT use labels for issue classification (bug, feature, etc.)
# Use labels for metadata (priority, status, auto-generated) only.
# Issue classification uses GitHub Issue Types, set via GraphQL after creation.
gh issue create -R gsd-build/gsd-2 \
--title "feat: add feature X" \
--label "priority:p1" --label "type:feature" \
--label "priority:p1" \
--milestone "v1.0"
# View issue
@ -120,6 +123,24 @@ gh issue edit <number> -R gsd-build/gsd-2 \
--remove-label "status:needs-grooming"
```
### Issue Types (Classification)
`gh issue create` has no `--type` flag. Issue types (Bug, Feature Request, etc.) are set via GraphQL after creation:
```bash
# Step 1: Create the issue (returns URL)
ISSUE_URL=$(gh issue create -R gsd-build/gsd-2 \
--title "..." --body "...")
# Step 2: Set the issue type via GraphQL
ISSUE_NUM=$(echo "$ISSUE_URL" | grep -oE '[0-9]+$')
ISSUE_ID=$(gh api graphql -f query='{ repository(owner:"gsd-build",name:"gsd-2") { issue(number:'"$ISSUE_NUM"') { id } } }' --jq '.data.repository.issue.id')
TYPE_ID=$(gh api graphql -f query='{ repository(owner:"gsd-build",name:"gsd-2") { issueTypes(first:20) { nodes { id name } } } }' --jq '.data.repository.issueTypes.nodes[] | select(.name=="Bug") | .id')
gh api graphql -f query='mutation { updateIssue(input:{id:"'"$ISSUE_ID"'",issueTypeId:"'"$TYPE_ID"'"}) { issue { number } } }'
```
Replace `"Bug"` with the appropriate type name (`"Feature Request"`, `"Task"`, etc.).
### Labels
```bash