Can someone please point me in the right direction for listing all open issues that are in repos owned by the user? Thanks in advance.
Asked
Active
Viewed 4,278 times
2 Answers
10
I think I've figured it out. Please let me know if there's a more optimal answer.
query {
search(first: 100, type: ISSUE, query: "user:will-stone state:open") {
issueCount
pageInfo {
hasNextPage
endCursor
}
edges {
node {
... on Issue {
createdAt
title
url,
repository {
name
}
}
}
}
}
}

Will Stone
- 4,626
- 3
- 21
- 29
3
Your answer is probably the most efficient way in terms of pagination, but another approach you could take is to iterate over all of the user's owned repositories, and for each of those repositories fetch their issues with something like:
query($userLogin: String!) {
user(login: $userLogin) {
repositories(affiliations: [OWNER], last: 10) {
edges {
node {
issues(states: [OPEN], last: 10) {
edges {
node {
createdAt
title
url
repository {
name
}
}
}
}
}
}
}
}
}

bswinnerton
- 4,533
- 8
- 41
- 56
-
Thanks. With this method, I end up with lots of empty repo entries (the ones that don't have any current issues). – Will Stone Mar 06 '18 at 21:22
-
2@WillStone, that's correct. Unfortunately there isn't a way to filter out repositories with no issues. If this is something you would find valuable, you can submit a schema request [here](https://platform.github.community/) and we can take a look. The tradeoff of using the `search` field is that it has to hit search infrastructure and will be much slower to return results. – bswinnerton Mar 09 '18 at 17:42