Retrieve git blame data using the GitHub GraphQL API

I’m trying to retrieve information about when a bug was first committed to a Git repository. I have a dataset which contains various single-line bugs, and each bug includes information such as: the SHA of the commit where the bug was fixed, the line number the bug occurred on, the path for the file the bug was found in, and the source code before and after the bug was fixed.

So I have the commit which contains the bug fix, but I also need to find the commit for when the bug was originally written. I know how to do this directly through the GitHub website, for example:

  1. This commit fixes a bug on line 184 in the file “”.
  2. If I view the file and go to line 184, I can click on it and select the “view git blame” option from the menu, which takes me to here.
  3. Now next to this line is a button which is labelled “view blame prior to this change”, which takes me to here.
  4. On this page I can now see that the original line of code which caused the bug was introduced in this commit.

Currently, using the GitHub GraphQL API v4, I’ve only managed to get as far as step 2. Using the below query and the same example, the results only point me to the commit where the bug was fixed, not where the bug was introduced.

query {
  repository(owner:"Activiti", name:"Activiti") {
    object(oid:"0bd20565a165db6872caca59473160ed3adbac7f") {
      ... on Commit {
        blame(path: "modules/activiti-form-engine/src/main/java/org/activiti/form/engine/impl/cmd/") {
          ranges {
            commit {

The git blame information for the change starting and ending on line 184 is:

  "startingLine": 184,
  "endingLine": 184,
  "commit": {
    "oid": "0bd20565a165db6872caca59473160ed3adbac7f",
    "committedDate": "2017-05-20T12:57:05Z"

So what I’m asking is, how do I progress to step 3 and 4 using the GitHub API? I essentially need to use the “view blame prior to this change” functionality through the API, though is this even possible? If not, is there another way of doing it? I’d also like to note that this is my first time writing queries for the GitHub API, so any improvements on my example query are welcome.