Filter repository history by "login" instead of "id"

community-help

#1

Hi there,

II’m trying to get a list commits by user for a particular repository. I am able to do that by filtering by id , like:

query CommitsById {
  repository(owner: "elastic", name: "kibana") {
    ref(qualifiedName: "master") {
      target {
        ... on Commit {
          id
          history(first: 10, author: {id: "MDQ6VXNlcjIwOTk2Ng=="}) {
            nodes {
              message
            }
          }
        }
      }
    }
  }
}

The id (MDQ6VXNlcjIwOTk2Ng==) is not super handy - I would much prefer if I could supply a Github username (also called “login”).
To make matters worse, other APIs are inconsistent, eg. the user endpoint requires “login”, not “id”:

query AuthorByLogin {
  user(login:"sqren") {
    name
  }
}

This means I have to use two different identifiers, to get a list of commits and the name for a single user.

To summarize:

  1. How can I use a single identifier to get a list of commits filter by user for a particular repo; and to get name for a user?
  2. I would prefer using “login” over “id”.

Thanks in advance!


#2

Thanks for opening this topic @sqren.

I’ve created an internal issue to track this request. I can’t make any promises but we’ll be sure to update you here if/when we add this to the schema.


#3

+1 Need this as well.