Reputation: 5088
The Github API has a clear method for seeing whether a pull request has been closed or not. For example, this pull request, has been closed, and we can determine that using an API call.
However, some pull requests are "closed from a commit", e.g. here. How can one use the Github API to determine whether a pull request is just "closed" or "closed from a commit"?
Upvotes: 1
Views: 141
Reputation: 1253
Your example is actually not of a pull request but rather an issue. You can see information about the closing of an issue through GitHub's Issue Events API.
List events for an issue
GET /repos/:owner/:repo/issues/:issue_number/events
Response
Status: 200 OK Link: <https://api.github.com/resource?page=2>; rel="next", <https://api.github.com/resource?page=5>; rel="last" X-RateLimit-Limit: 5000 X-RateLimit-Remaining: 4999 [ { "id": 1, "url": "https://api.github.com/repos/octocat/Hello-World/issues/events/1", "actor": { "login": "octocat", "id": 1, "avatar_url": "https://github.com/images/error/octocat_happy.gif", "gravatar_id": "", "url": "https://api.github.com/users/octocat", "html_url": "https://github.com/octocat", "followers_url": "https://api.github.com/users/octocat/followers", "following_url": "https://api.github.com/users/octocat/following{/other_user}", "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", "organizations_url": "https://api.github.com/users/octocat/orgs", "repos_url": "https://api.github.com/users/octocat/repos", "events_url": "https://api.github.com/users/octocat/events{/privacy}", "received_events_url": "https://api.github.com/users/octocat/received_events", "type": "User", "site_admin": false }, "event": "closed", "commit_id": "6dcb09b5b57875f334f61aebed695e2e4193db5e", "created_at": "2011-04-14T16:00:49Z" } ]
Notice the commit_id
field in the response.
Upvotes: 2