How can I find how many of my GitHub pull requests have been accepted?

浪尽此生 提交于 2019-12-21 05:00:05

问题


Is there a way to find out the acceptance rate of one's GitHub PR's, probably using the API?

While at that, it would be interesting to find out how many of the issues I reported have been closed vs. are still open, across all repos.


回答1:


I don't see a way to get that information directly. That leaves you with the GitHub Issues Events API.
With that, you can list all the events of a repo:

GET /repos/:owner/:repo/issues/events
https://api.github.com/repos/user/reponame/issues/events

And filter on a user and an event (looking for "merged": true)




回答2:


Certainly there is an indirect way to know your all accepted PR requests and that is GitHub resume. Yes, GitHub resume is something which generates resume of users on the basis of their GitHub activity.

So, go and start the project https://github.com/resume/resume.github.com and then visit http://resume.github.io. There you will see list of your all accepted PR requests.

Note: You need to star the project first, they don't allow to generate the resume otherwise.




回答3:


You can also use GraphQL API v4 to use a single request to get total number of issues, PR with count per state (CLOSED, OPENED or MERGED) :

{
  user(login: "bertrandmartel") {
    totalPR: pullRequests {
      totalCount
    }
    openedPR: pullRequests(states: OPEN) {
      totalCount
    }
    closedPR: pullRequests(states: CLOSED) {
      totalCount
    }
    mergedPR: pullRequests(states: MERGED) {
      totalCount
    }
    totalIssues: issues {
      totalCount
    }
    openedIssues: issues(states: OPEN) {
      totalCount
    }
    closedIssues: issues(states: CLOSED) {
      totalCount
    }
  }
}

Try it in the explorer

which gives you a result like the following :

{
  "data": {
    "user": {
      "totalPR": {
        "totalCount": 17
      },
      "openedPR": {
        "totalCount": 4
      },
      "closedPR": {
        "totalCount": 1
      },
      "mergedPR": {
        "totalCount": 12
      },
      "totalIssues": {
        "totalCount": 80
      },
      "openedIssues": {
        "totalCount": 7
      },
      "closedIssues": {
        "totalCount": 73
      }
    }
  }
}


来源:https://stackoverflow.com/questions/21718759/how-can-i-find-how-many-of-my-github-pull-requests-have-been-accepted

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!