Getting the number of commits ahead/behind upstream via GraphQL

Hi,

I am trying to fetch the equivalent of “This branch is 84 commits behind upstream:master” (eg. in https://github.com/AlexLaviolette/slack-gamebot) via GraphQL. 

I got as far as the branch list. Ideas?

query($owner: String!, $name: String!, $forksCursor: String, $refsCursor: String) {
  repository(owner: $owner, name: $name) {
    forks(first: 3, after: $forksCursor, orderBy: { field: PUSHED_AT, direction: DESC }) {
      edges {
        cursor
        node {
          refs(first: 3, after: $refsCursor, refPrefix:"refs/heads/") {
            nodes {
              name
            }
          }
          nameWithOwner
          pushedAt
        }
      }
    }
  }
}
2 Likes

Hey @dblock,

Thanks for being here! I don’t think is a schema currently supported, let me dig in some more and I’ll post any updates here.

Any word on this yet?

1 Like