How can I determine which Pull Request a commit belongs to using the GitHub API?
It is possible, using the Search API, which supports this feature:
https://help.github.com/articles/searching-issues/#search-by-the-commit-shas-within-a-pull-request
For example:
https://api.github.com/search/issues?q=ee49f07dba3821109b3cf45404446f434a897558
returns a single result, which is this pull request:
https://api.github.com/repos/hammerlab/pileup.js/issues/328
It seems to be possible using this new feature in the API v.3:
https://developer.github.com/v3/repos/commits/#list-pull-requests-associated-with-a-commit
This URL now redirects to:
https://docs.github.com/en/rest/reference/repos#list-pull-requests-associated-with-a-commit
This is the syntax:
GET /repos/:owner/:repo/commits/:commit_sha/pulls