是否有可能使用一些 API 获取用户在不同回购协议上发出的所有拉取请求?

Is it possible to get all the pull requests made by a user on different repos using some API?

我正在制作一个应用程序,我需要在其中获取特定用户在各种存储库上发出的所有拉取请求。

我可以获取特定存储库上的所有拉取请求,但找不到合适的 API 来获取用户的所有拉取请求。

我可以进行什么样的 API 调用来让作者过滤那些 PR?

List Pull Request API有一个头部过滤器:

head string

Filter pulls by head user and branch name in the format of user:ref-name.

示例:github:new-script-format.

这对你的情况不起作用,因为你不知道分支名称,只知道作者。

改用 search API for issues

GET /search/issues

它可以过滤:

  • type:使用此限定符,您可以将搜索限制为问题(issue)或拉取请求(pr 仅。
  • author:查找某个用户创建的议题或拉取请求。

尝试使用以下代码

var d=2018-09-30T10%3A00%3A00%2B00%3A00   //start date
var f=2018-11-01T12%3A00%3A00%2B00%3A00   //end date
var t=iamshouvikmitra                     //username


$.getJSON("https://api.github.com/search/issues?q=-label:invalid+created:" + d + ".." + f + "+type:pr+is:public+author:" + t + "&per_page=300", function(e) {


}

事实上,这类似于 https://hacktoberfest.digitalocean.com 用于计算您在 10 月份提交的拉取请求数量的代码。