Search code examples
githubgithub-api

Is it possible to run something like git blame -L 1,5 README.md with GitHub's API?


I am seeing Gists all over the place that show a very basic example of a GraphQL query that passes a file path as a parameter and then the query returns the starting and ending lines, plus the commit hashes of such.

Something like this https://gist.github.com/davidcelis/dd85095ac46e159b9efe420687aaa7e9

Is it possible to pass a starting line and an ending line as a parameter? "I want to obtain the commit hashes of lines 1 to 5 in README.md"


Solution

  • The only field for Blame inside Commit is... path.

    So you cannot add a BlameRange as parameter. You can only get ranges as a result of a query.