I'm trying to migrate from GitHub's REST API to their GraphQL API in my GitHub bot. I want to filter open issues created by my bot on this repository.
I've tried the following queries:
query ListOpenIssues {
repository(name: "pacstall-programs", owner: "pacstall") {
issues(last: 100, filterBy: {states: OPEN, createdBy: "app/pacstall-pacbot"}) {
nodes {
number
title
url
}
}
}
}
query ListOpenIssues {
repository(name: "pacstall-programs", owner: "pacstall") {
issues(last: 100, filterBy: {states: OPEN, createdBy: "pacstall-pacbot"}) {
nodes {
number
title
url
}
}
}
}
But both of them return
{
"data": {
"repository": {
"issues": {
"nodes": []
}
}
}
}
How do I properly filter the issues created by my bot?
PS: I've seen this similar question, but it was created 3 years ago, and since then GitHub's GraphQL API has changed, and supports the createdBy field to filter issues.
According to GitHub support, the solution is to append "[bot]" to author fields when filtering:
query ListOpenIssues {
repository(name: "pacstall-programs", owner: "pacstall") {
issues(last: 3, filterBy: {createdBy: "pacstall-pacbot[bot]"}) {
nodes {
title
}
}
}
}
I have asked GH support to update the documentation as this is not mentioned anywhere.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With