问题
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