0

我使用 API 并能够找到我曾经贡献过的所有存储库,但我很难找到我的第一个提交。

我尝试了什么:

{
  viewer {
    repositoriesContributedTo(first: 100, privacy: PUBLIC, contributionTypes: COMMIT, before: "2013-07-11T00:00:00") {
      totalCount
      nodes {
        nameWithOwner
      }
      pageInfo {
        endCursor
        hasNextPage
      }
    }
  }
}

我得到了什么:

{
  "errors": [
    {
      "type": "INVALID_CURSOR_ARGUMENTS",
      "path": [
        "viewer",
        "repositoriesContributedTo",
        "nodes"
      ],
      "locations": [
        {
          "line": 5,
          "column": 7
        }
      ],
      "message": "`2013-07-11T00:00:00` does not appear to be a valid cursor."
    },
    {
      "type": "INVALID_CURSOR_ARGUMENTS",
      "path": [
        "viewer",
        "repositoriesContributedTo",
        "pageInfo"
      ],
      "locations": [
        {
          "line": 8,
          "column": 7
        }
      ],
      "message": "`2013-07-11T00:00:00` does not appear to be a valid cursor."
    }
  ]
}

GitHub 的 GraphQL 浏览器链接: https ://developer.github.com/v4/explorer/

4

1 回答 1

0

要查找第一个提交,您可以按CREATED_AT升序排序:

{
  viewer {
    repositoriesContributedTo(
      first: 100
      orderBy: {
        field : CREATED_AT
        direction : ASC
      }
      privacy: PUBLIC
      contributionTypes: COMMIT) {
      totalCount
      nodes {
        nameWithOwner
      }
      pageInfo {
        startCursor
        endCursor
        hasNextPage
      }
    }
  }
}

PSbefore输入参数中的字段应该分配有光标值,该光标值是从结果中的startCursoror而不是日期字符串中获得的。endCursorpageInfo

于 2019-11-21T17:23:45.497 回答