On the github website, a lot of issues are connected(referenced) with pull request or commits. Is there a way we can find the connection in the github archive database or in the github API?
on github, Is there a way to find the connection between issues and pullrequest, between issues and commits,etc
123 views Asked by Deng Tianjie At
2
There are 2 answers
2
On
When you are querying a pull request through the GitHub V3 Pull Request API, you do see a reference to an issue, and a commit:
GET /repos/:owner/:repo/pulls/:number
Response
Status: 200 OK
X-RateLimit-Limit: 5000
X-RateLimit-Remaining: 4999
{
"url": "https://api.github.com/octocat/Hello-World/pulls/1",
"html_url": "https://github.com/octocat/Hello-World/pulls/1",
"diff_url": "https://github.com/octocat/Hello-World/pulls/1.diff",
"patch_url": "https://github.com/octocat/Hello-World/pulls/1.patch",
"issue_url": "https://github.com/octocat/Hello-World/issue/1",
"number": 1,
"state": "open",
"title": "new-feature",
"body": "Please pull these awesome changes",
"created_at": "2011-01-26T19:01:12Z",
"updated_at": "2011-01-26T19:01:12Z",
"closed_at": "2011-01-26T19:01:12Z",
"merged_at": "2011-01-26T19:01:12Z",
"head": {
"label": "new-topic",
"ref": "new-topic",
"sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
...
That is one way to get the association you are after, from a given pull request.
There is no way to request issues or commits that are linked via numbering. I'm guessing that you want something to show you when a commit message has something akin to "Fixes #13" and give you the commit and the issue. That is not possible. As best I know (and as the API is currently documented) this is impossible without parsing commit messages and issue/issue comment bodies yourself. This would be rather exhaustive and altogether unreliable in most cases. Some of those may not reference GitHub issues even though the source is on GitHub.
You can always see if they'll entertain the request though by contacting GitHub