Github API调用:按提交日期过滤 [英] Github API call: filter by committer-date
问题描述
我正在使用github API,试图查找特定日期的所有提交.
I'm using the github api, trying to find all my commits on a specific day.
此查询符合预期,返回我的所有提交:
This query, as expected, returns all my commits:
https://api.github.com/search/commits?q = committer-email:foo@bar.com
但是此查询返回相同的列表,包括超出指定日期范围的结果:
But this query returns that same list, including results outside the specified date range:
(这些查询需要设置标头:Accept:application/vnd.github.cloak-preview)
(These queries require a header to be set: Accept: application/vnd.github.cloak-preview)
为什么committer-date参数无法正常工作?
Why does the committer-date parameter not work like it's supposed to?
以下是提交搜索的文档: https://developer.github. com/v3/search/#search-commits
Here are the docs for the commit search: https://developer.github.com/v3/search/#search-commits
推荐答案
查询中存在一个小的语法错误.尝试将
&
更改为+
,将=
更改为:
.进行这些更改,您的查询将变为-There is a small syntax error in the query. Try changing
&
to+
and=
to:
. Making these changes your query would become -
curl -H 'Accept: application/vnd.github.cloak-preview' \https://api.github.com/search/commits?q=committer-email:foo@bar.com+committer-date:2017-08-13..2017-08-14
.在终端上运行此命令时,我只提交了一次(请参见下面的截断结果).
When I run this on my terminal, I just get one commit (see the truncated results below).
Medapas-MacBook-Air:~ medapa$ curl -H 'Accept: application/vnd.github.cloak-preview' \https://api.github.com/search/commits?q=committer-email:foo@bar.com+committer-date:2017-08-13..2017-08-14 { "total_count": 1, "incomplete_results": false, "items": [ { "url": "https://api.github.com/repos/mstricklin/batis00/commits/af9295b930223e394f7f0d742af351ea3ef02351", "sha": "af9295b930223e394f7f0d742af351ea3ef02351", "html_url": "https://github.com/mstricklin/batis00/commit/af9295b930223e394f7f0d742af351ea3ef02351", "comments_url": "https://api.github.com/repos/mstricklin/batis00/commits/af9295b930223e394f7f0d742af351ea3ef02351/comments", "commit": { "url": "https://api.github.com/repos/mstricklin/batis00/git/commits/af9295b930223e394f7f0d742af351ea3ef02351", "author": { "date": "2017-08-13T20:10:55.000-05:00", "name": "mstricklin", "email": "foo@bar.com" }, "committer": { "date": "2017-08-13T20:10:55.000-05:00", "name": "mstricklin", "email": "foo@bar.com" }, "message": "01", "tree": { "url": "https://api.github.com/repos/mstricklin/batis00/git/trees/e0fe96439a79eb6d84996f351025488bb0e7114d", "sha": "e0fe96439a79eb6d84996f351025488bb0e7114d" }, "comment_count": 0 }, "author": { "login": "invalid-email-address",
这篇关于Github API调用:按提交日期过滤的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!