我目前正在使用GitHub作为scm。我目前正在构建一个工具,但遇到了一些问题。有没有办法检查拉取请求受让人以及谁批准了拉取请求?
在bitbucket中这很容易实现,但是使用GitHub我看不到它在哪里:/
答案 0 :(得分:0)
您可以使用我们的问题API获取拉取请求的受让人:
https://developer.github.com/v3/issues
具体来说,这个终点:
https://developer.github.com/v3/issues/#get-a-single-issue
由于Multiple Assignees API仍处于预览模式,您需要在Accept Header中明确传递此自定义媒体类型:
应用/ vnd.github.cerberus预览+ JSON
从请求中省略此标头不会显示问题或请求的多个受理人。
curl https://api.github.com/repos/angular/angular/issues/9355 \
-H "Accept: application/vnd.github.cerberus-preview+json" \
The payload should look something like this, including both assignees
{
"url": "https://api.github.com/repos/angular/angular/issues/9355",
"repository_url": "https://api.github.com/repos/angular/angular",
"labels_url": "https://api.github.com/repos/angular/angular/issues/9355/labels{/name}",
"comments_url": "https://api.github.com/repos/angular/angular/issues/9355/comments",
"events_url": "https://api.github.com/repos/angular/angular/issues/9355/events",
"html_url": "https://github.com/angular/angular/pull/9355",
"id": 161102291,
"number": 9355,
"title": "fix(HTTP/XhrBackend): correctly set the status code on errors",
"user": {
"login": "vicb",
"id": 248818,
"avatar_url": "https://avatars.githubusercontent.com/u/248818?v=3",
"gravatar_id": "",
"url": "https://api.github.com/users/vicb",
"html_url": "https://github.com/vicb",
"followers_url": "https://api.github.com/users/vicb/followers",
"following_url": "https://api.github.com/users/vicb/following{/other_user}",
"gists_url": "https://api.github.com/users/vicb/gists{/gist_id}",
"starred_url": "https://api.github.com/users/vicb/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/vicb/subscriptions",
"organizations_url": "https://api.github.com/users/vicb/orgs",
"repos_url": "https://api.github.com/users/vicb/repos",
"events_url": "https://api.github.com/users/vicb/events{/privacy}",
"received_events_url": "https://api.github.com/users/vicb/received_events",
"type": "User",
"site_admin": false
},
"labels": [
{
"url": "https://api.github.com/repos/angular/angular/labels/cla:%20yes",
"name": "cla: yes",
"color": "009800"
},
{
"url": "https://api.github.com/repos/angular/angular/labels/comp:%20http",
"name": "comp: http",
"color": "c7def8"
},
{
"url": "https://api.github.com/repos/angular/angular/labels/pr_action:%20review",
"name": "pr_action: review",
"color": "fbca04"
},
{
"url": "https://api.github.com/repos/angular/angular/labels/type:%20bug",
"name": "type: bug",
"color": "EEEEEE"
}
],
"state": "open",
"locked": false,
"assignee": {
"login": "jeffbcross",
"id": 463703,
"avatar_url": "https://avatars.githubusercontent.com/u/463703?v=3",
"gravatar_id": "",
"url": "https://api.github.com/users/jeffbcross",
"html_url": "https://github.com/jeffbcross",
"followers_url": "https://api.github.com/users/jeffbcross/followers",
"following_url": "https://api.github.com/users/jeffbcross/following{/other_user}",
"gists_url": "https://api.github.com/users/jeffbcross/gists{/gist_id}",
"starred_url": "https://api.github.com/users/jeffbcross/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/jeffbcross/subscriptions",
"organizations_url": "https://api.github.com/users/jeffbcross/orgs",
"repos_url": "https://api.github.com/users/jeffbcross/repos",
"events_url": "https://api.github.com/users/jeffbcross/events{/privacy}",
"received_events_url": "https://api.github.com/users/jeffbcross/received_events",
"type": "User",
"site_admin": false
},
"milestone": {
"url": "https://api.github.com/repos/angular/angular/milestones/62",
"html_url": "https://github.com/angular/angular/milestones/2.0.0-rc.3",
"labels_url": "https://api.github.com/repos/angular/angular/milestones/62/labels",
"id": 1831054,
"number": 62,
"title": "2.0.0-rc.3",
"description": "",
"creator": {
"login": "IgorMinar",
"id": 216296,
"avatar_url": "https://avatars.githubusercontent.com/u/216296?v=3",
"gravatar_id": "",
"url": "https://api.github.com/users/IgorMinar",
"html_url": "https://github.com/IgorMinar",
"followers_url": "https://api.github.com/users/IgorMinar/followers",
"following_url": "https://api.github.com/users/IgorMinar/following{/other_user}",
"gists_url": "https://api.github.com/users/IgorMinar/gists{/gist_id}",
"starred_url": "https://api.github.com/users/IgorMinar/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/IgorMinar/subscriptions",
"organizations_url": "https://api.github.com/users/IgorMinar/orgs",
"repos_url": "https://api.github.com/users/IgorMinar/repos",
"events_url": "https://api.github.com/users/IgorMinar/events{/privacy}",
"received_events_url": "https://api.github.com/users/IgorMinar/received_events",
"type": "User",
"site_admin": false
},
"open_issues": 25,
"closed_issues": 14,
"state": "open",
"created_at": "2016-06-15T23:19:22Z",
"updated_at": "2016-06-20T17:55:29Z",
"due_on": null,
"closed_at": null
},
"comments": 0,
"created_at": "2016-06-20T01:21:21Z",
"updated_at": "2016-06-20T01:21:22Z",
"closed_at": null,
"pull_request": {
"url": "https://api.github.com/repos/angular/angular/pulls/9355",
"html_url": "https://github.com/angular/angular/pull/9355",
"diff_url": "https://github.com/angular/angular/pull/9355.diff",
"patch_url": "https://github.com/angular/angular/pull/9355.patch"
},
"body": "fixes #9329\r\nfixes angular/http#54\r\n\r\n@robwormald @jeffbcross could one of you please review ? Thanks",
"closed_by": null,
"assignees": [
{
"login": "jeffbcross",
"id": 463703,
"avatar_url": "https://avatars.githubusercontent.com/u/463703?v=3",
"gravatar_id": "",
"url": "https://api.github.com/users/jeffbcross",
"html_url": "https://github.com/jeffbcross",
"followers_url": "https://api.github.com/users/jeffbcross/followers",
"following_url": "https://api.github.com/users/jeffbcross/following{/other_user}",
"gists_url": "https://api.github.com/users/jeffbcross/gists{/gist_id}",
"starred_url": "https://api.github.com/users/jeffbcross/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/jeffbcross/subscriptions",
"organizations_url": "https://api.github.com/users/jeffbcross/orgs",
"repos_url": "https://api.github.com/users/jeffbcross/repos",
"events_url": "https://api.github.com/users/jeffbcross/events{/privacy}",
"received_events_url": "https://api.github.com/users/jeffbcross/received_events",
"type": "User",
"site_admin": false
},
{
"login": "robwormald",
"id": 534930,
"avatar_url": "https://avatars.githubusercontent.com/u/534930?v=3",
"gravatar_id": "",
"url": "https://api.github.com/users/robwormald",
"html_url": "https://github.com/robwormald",
"followers_url": "https://api.github.com/users/robwormald/followers",
"following_url": "https://api.github.com/users/robwormald/following{/other_user}",
"gists_url": "https://api.github.com/users/robwormald/gists{/gist_id}",
"starred_url": "https://api.github.com/users/robwormald/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/robwormald/subscriptions",
"organizations_url": "https://api.github.com/users/robwormald/orgs",
"repos_url": "https://api.github.com/users/robwormald/repos",
"events_url": "https://api.github.com/users/robwormald/events{/privacy}",
"received_events_url": "https://api.github.com/users/robwormald/received_events",
"type": "User",
"site_admin": false
}
]
}