【问题标题】:GitHub API V3 list pull request assignees and pull request aprovalsGitHub API V3 列出拉取请求受让人和拉取请求批准
【发布时间】:2016-10-21 10:34:10
【问题描述】:

我目前正在使用 GitHub 作为 scm。我目前正在围绕它构建一个工具,但遇到了一些问题。有什么方法可以检查拉取请求的受让人以及谁批准了拉取请求?

在 bitbucket 中这样做真的很容易,但是使用 GitHub 我看不到在哪里做:/

【问题讨论】:

    标签: github-api pull-request


    【解决方案1】:

    您可以使用我们的问题 API 获取拉取请求的受理人:

    https://developer.github.com/v3/issues

    具体来说,这个端点:

    https://developer.github.com/v3/issues/#get-a-single-issue

    由于 Multiple Assignees API 仍处于预览模式,您需要在 Accept Header 中显式传递此自定义媒体类型:

    application/vnd.github.cerberus-preview+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
        }
      ]
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-10-02
      • 2011-05-05
      • 1970-01-01
      • 2022-01-23
      • 1970-01-01
      • 2014-11-30
      相关资源
      最近更新 更多