如何使用 github api 查找批准拉取请求的用户?

use*_*478 4 github github-api

例如,鉴于此拉取请求:https : //github.com/harsh-groverfk/jenkins-demo/pull/16

如何在这些拉取请求中找到“批准”更改的用户列表。

这是此拉取请求的示例审查:https : //github.com/harsh-groverfk/jenkins-demo/pull/16#pullrequestreview-16967726

bit*_*oiu 7

您可以通过使用Pull Request API 端点List Reviews来做到这一点。对于您列出的示例 PR,这将是:

GET /repos/harsh-groverfk/jenkins-demo/pulls/16/reviews

这将输出在 PR 上完成的所有评论(文档中的示例):

[
  {
    "id": 80,
    "user": {
      "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
    },
    "body": "Here is the body for the review.",
    "commit_id": "ecdd80bb57125d7ba9641ffaa4d7d2c19d3f3091",
    "state": "APPROVED",
    "html_url": "https://github.com/octocat/Hello-World/pull/12#pullrequestreview-80",
    "pull_request_url": "https://api.github.com/repos/octocat/Hello-World/pulls/12",
    "_links": {
      "html": {
        "href": "https://github.com/octocat/Hello-World/pull/12#pullrequestreview-80"
      },
      "pull_request": {
        "href": "https://api.github.com/repos/octocat/Hello-World/pulls/12"
      }
    }
  }
]
Run Code Online (Sandbox Code Playgroud)