DEV Community

Cover image for Query Github GraphQL

Posted on

Query Github GraphQL

Searching for a package on Github can be a daunting task, because the returns can be overwhelming, and it can be extremely time consuming to wade through them one by one.

Over the years, my Github searching experiences can be summarized in one word — “frustrating”, because not a single searching strategy is fully working, due to the overwhelming hits that I’m getting. The problem for me is all about how to order them:

  • If you don’t specify any order, then by default it’s Github’s best match ordering. However, I’ve seen many times that some projects that haven’t been updated for years showed up on top, because, once-up-a-time, it was popular before.
  • If you order by number of stars, then still, you can’t avoid those been-popular-once projects, and only when clicking open it, you realized, from the over-a-hundred open issues, that it has now been abandoned.
  • Then you can’t help but wondering, where the crowd have moved to? There must be a new project that is better than the abandoned one, but which one it is? So you order them by creation day to have newer created ones listed first.
  • However, if you have ever done so, you will regret it right away, because all the hits that come on the top are those being recently created by all sorts of people just for trying things out. You’d been gone through several pages of returns without seeing a single meaningful, serious project.
  • At this time, when you try to see if there are any more meaningful search orders left, you will notice that the options are rather limited. What has left make even less sense than you’ve tried so far.
  • So wouldn’t it be great if I can arrange the hits with my own order? Which takes into the consideration not only the number of stars, and not only when it was created, but everything else as well, such as, how many opening issues, how many issues in total, how many releases has been made, how many people forked it, how many Pull Requests so far, etc, etc, wouldn’t it be great?

Yes, but it wouldn’t be possible, unless using the Github GraphQL query. Long story short, this is the GraphQL query that I use...

Please continue to
where GraphQL code and may examples are given, which is hard to port over here.

But I'm dicthing and moving my blog to, from now on.

Top comments (0)