检查用户是否在特定日期使用API​​提交给Github [英] Checking if a user made a commit to Github using API on a given day

查看:119
本文介绍了检查用户是否在特定日期使用API​​提交给Github的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试构建一个应用程序来跟踪GitHubStreaks(用户向GitHub提交的连续几天)。我尝试使用GitHub API来执行此操作,但我无法确定在哪里。



如果我无法挽回连胜,如果我能找到一种方法来查看他们是否在某一天犯下了错误(如昨天),我可以递归确定通过继续检查前一天,直到没有提交。



我可以找到有关特定提交 https://developer.github.com/v3/repos/commits/



我可以为单个用户检索数据:
https://developer.github.com/v3/users/#get-a-single-user



但我似乎无法找到如何查询API以确定用户是否在给定日期进行了提交。 您可以尝试使用GitHub搜索提交此API。例如,要在 2017-08-28 上找到用户 km-poonacha 的提交,可以发出以下请求。



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



Ref。 搜索提交


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.

解决方案

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

这篇关于检查用户是否在特定日期使用API​​提交给Github的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆