Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to filter by issues created by GitHub App using their GraphQL API?

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.

like image 372
Wizard28 Avatar asked Mar 19 '26 23:03

Wizard28


1 Answers

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.

like image 87
Arnold Zokas Avatar answered Mar 22 '26 15:03

Arnold Zokas



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!