gh api graphql -f query='
{
# https://github.com/github/docs
repository(owner: "github", name: "docs") {
id # RepositoryID
name
discussionCategories(first: 10) {
nodes {
id # CategoryID
name
}
}
}
}'
Result:
{
"data": {
"repository": {
"id": "MDEwOlJlcG9zaXRvcnkxODk2MjE2MDc=",
"name": "docs",
"discussionCategories": {
"nodes": [{
"id": "MDE4OkRpc2N1c3Npb25DYXRlZ29yeTI1MDUzMjQ3",
"name": "General"
},
{
"id": "MDE4OkRpc2N1c3Npb25DYXRlZ29yeTI1MDUzMjUw",
"name": "Ideas"
},
{
"id": "MDE4OkRpc2N1c3Npb25DYXRlZ29yeTI1MDUzMjQ5",
"name": "Q&A"
},
{
"id": "MDE4OkRpc2N1c3Npb25DYXRlZ29yeTI1MDUzMjUx",
"name": "Show and tell"
}
]
}
}
}
}
Ref: