Is there a way to get all sub-issues from the API? #203244
Replies: 2 comments 2 replies
|
💬 Your Product Feedback Has Been Submitted 🎉 Thank you for taking the time to share your insights with us! Your feedback is invaluable as we build a better GitHub experience for all our users. Here's what you can expect moving forward ⏩
Where to look to see what's shipping 👀
What you can do in the meantime 💻
As a member of the GitHub community, your participation is essential. While we can't promise that every suggestion will be implemented, we want to emphasize that your feedback is instrumental in guiding our decisions and priorities. Thank you once again for your contribution to making GitHub even better! We're grateful for your ongoing support and collaboration in shaping the future of our platform. ⭐ |
|
The issue-search endpoint and the UI/Projects filters do not currently expose the same hierarchy filters. In particular, For a repository-wide list, GraphQL is the cleanest workaround because gh api graphql --paginate \
-f owner=OWNER \
-f repo=REPO \
-f query='
query($owner: String!, $repo: String!, $endCursor: String) {
repository(owner: $owner, name: $repo) {
issues(
first: 100
after: $endCursor
states: OPEN
orderBy: {field: CREATED_AT, direction: ASC}
) {
pageInfo { hasNextPage endCursor }
nodes {
number
title
url
parent {
number
url
repository { nameWithOwner }
}
}
}
}
}
' \
--jq '.data.repository.issues.nodes[]
| select(.parent != null)
| {
issue: .number,
title,
url,
parent: ("\(.parent.repository.nameWithOwner)#\(.parent.number)")
}'That returns only open issues in REST now has dedicated sub-issue relation endpoints, including References: |
Uh oh!
There was an error while loading. Please reload this page.
🏷️ Discussion Type
Bug
💬 Feature/Topic Area
API
Body
This is similar to this discussion: https://github.com/orgs/community/discussions/191833
However, the provided answer there does not work as expected.
In the GitHub UI, I can query for records that have a parent-issue and get a list of all of the sub-issues

However, when I provide the same search to the rest API such as:
https://api.github.com:443/search/issues?q=is:issue+state:open+has:parent-issue+repo:<repo name>it will return all of the open issue regardless of if they have a parent issue or not.
I've also tried
is:sub-issue,has:sub-issuebut neither of these manage to filter to sub-issues.I have found that
no:parent-issuedoes return all of the non-subissues. However, I cannot get just a list of issues that ARE sub-issues.Is there a way to to this at all using the REST API?
All reactions