mcheah
mcheah

Reputation: 1326

How to use Github GraphQL search for my own commits?

I'm trying to use the Github GraphQL to get a list of my organization's commits between this month and last month. I could just specify the first 100 commits and paginate backwards,

repository(owner: "myOrg", name: "myRepo") {
    ref(qualifiedName: "master") {
        target {
        ... on Commit {
            history(first: 100) {

but it seems like the API should be set up to allow a more specific search so it doesn't have to do as much work. I know that you can query Repositories, Issues, and Users using a search query but this doesn't seem to do the same thing as just asking for the specific results I need.

What is best way to filter specific commits, or any information really, using GraphQL without making a ton of unnecessary requests?

Thanks!

Upvotes: 1

Views: 899

Answers (1)

Casey Benko
Casey Benko

Reputation: 2308

Did you try since and until?

Like this:

repository(owner: "myOrg", name: "myRepo") {
    ref(qualifiedName: "master") {
        target {
        ... on Commit {
            history(since: "2018-04-01T22:29:24+00:00", until: "2018-05-14T22:29:24+00:00") {

Upvotes: 2

Related Questions