GitHub API-获取作者在存储库中的评论总数

时间:2020-06-28 10:38:07

标签: github github-api

我知道我可以通过以下方式获得给定用户打开的PR的数量

https://api.github.com/search/issues?q=is:pr+repo:<owner>/<repo>+author:<username>+is:open

但是给定用户审核过的PR的数量如何?

1 个答案:

答案 0 :(得分:1)

v3(REST)API中似乎没有此功能,但是我在v4(GraphQL)API中找到了totalPullRequestReviewContributions

{
  user(login: "nickmccurdy") {
    contributionsCollection {
      totalPullRequestReviewContributions
    }
  }
}

进行GraphQL查询后,您将获得此JSON结果。仅totalPullRequestReviewContributions的数字应更改。

{
  "data": {
    "user": {
      "contributionsCollection": {
        "totalPullRequestReviewContributions": 80
      }
    }
  }
}

由于它使用的是v4(GraphQL)API,因此您可以从GraphiQL API Explorer中对其进行测试:https://developer.github.com/v4/explorer/