Github API - retrieve user commits?

后端 未结 5 1146
日久生厌
日久生厌 2021-02-13 11:36

I\'m trying build a method in which I can access a Github user name, and publish either all commits or at least a number of commits from that user.

Is there a call to GE

5条回答
  •  梦如初夏
    2021-02-13 12:12

    You can use the commit search API and filter by the author.

    You can search by author or committer using author:USERNAME.

    Here is an example CURL request:

    curl -u : \
        -X GET \
      'https://api.github.com/search/commits?q=author:&sort=author-date&order=desc&page=1' \
      -H 'Accept: application/vnd.github.cloak-preview'
    

    See this article on how to create a personal access token.

    Remember: the search API only allows 30 results/minute for authenticated API calls and 10 for unauthenticated calls, and a maximum of 1000 results overall.

    Furthermore, use pagination in order to check for all the results, otherwise, they will be maximum 30 per page.

提交回复
热议问题