6

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:

https://api.github.com/search/commits?q=committer-email:foo@bar.com&committer-date=2017-08-13..2017-08-14

(These queries require a header to be set: Accept: application/vnd.github.cloak-preview)

Why does the committer-date parameter not work like it's supposed to?

Here are the docs for the commit search: https://developer.github.com/v3/search/#search-commits

Mike Miller
  • 3,368
  • 5
  • 36
  • 49

1 Answers1

3

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",
Poonacha
  • 1,267
  • 1
  • 8
  • 24