Checking if a user made a commit to Github using API on a given day

旧城冷巷雨未停 提交于 2019-12-23 18:01:37

问题


I am trying to build an app to track GitHub "Streaks" (How many days in a row a user has committed to GitHub.) I'm trying to use the GitHub API to do this, but I can't figure out where.

If I can't pull back the streak, if I could find a way to see if they had committed on a given day (like yesterday) I could recursively determine the streak by continuing to check the previous day until there wasn't a commit.

I can find details about a specific commit https://developer.github.com/v3/repos/commits/

And I can retrieve data for a single user: https://developer.github.com/v3/users/#get-a-single-user

But I can't seem to find how to query the API to determine if the user made a commit on a given day.


回答1:


You can try using the GitHub Search Commits API for this. For example, to find the commits for user km-poonacha on 2017-08-28 you can make the following request.

curl -H 'Accept: application/vnd.github.cloak-preview' \https://api.github.com/search/commits?q=author:km-poonacha+author-date:2017-08-28

Ref. Searching commits



来源:https://stackoverflow.com/questions/46855484/checking-if-a-user-made-a-commit-to-github-using-api-on-a-given-day

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