Github API - retrieve user commits?

后端 未结 5 1153
日久生厌
日久生厌 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 11:56

    UPDATE 2018-11-12

    The URLs mentioned below have now moved to a single URL that looks like https://github.com/AurelienLourot?from=2018-10-09 but the idea remains the same. See github-contribs.


    As pointed out by others, the official API won't allow you to get all GitHub repos a user has contributed to since the beginning of time.

    Still you can get that information by querying unofficial pages and parsing them in a loop:

    • https://github.com/users/AurelienLourot/created_commits?from=2018-05-17&to=2018-05-17
    • https://github.com/users/AurelienLourot/created_repositories?from=2018-05-17&to=2018-05-17
    • https://github.com/users/AurelienLourot/created_pull_requests?from=2018-05-17&to=2018-05-17
    • https://github.com/users/AurelienLourot/created_pull_request_reviews?from=2018-05-17&to=2018-05-17

    (Disclaimer: I'm the maintainer.)

    This is exactly what github-contribs does for you:

    $ sudo npm install -g @ghuser/github-contribs
    $ github-contribs AurelienLourot
    ✔ Fetched first day at GitHub: 2015-04-04.
    ⚠ Be patient. The whole process might take up to an hour... Consider using --since and/or --until
    ✔ Fetched all commits and PRs.
    35 repo(s) found:
    AurelienLourot/lsankidb
    reframejs/reframe
    dracula/gitk
    ...
    

提交回复
热议问题