How do you get total contributions with Githubs API v4

前端 未结 2 1342
半阙折子戏
半阙折子戏 2021-02-07 10:58

I have been looking through the Github V4 API docs and I cannot seem to find a way to query total contributions for the year (as displayed on your github profile). Has anyone ma

2条回答
  •  攒了一身酷
    2021-02-07 11:05

    The ContributionsCollection object provides total contributions for each contribution type between two dates.

    Note: from and to can be a maximum of one year apart, for a longer timeframe make multiple requests.

    query ContributionsView($username: String!, $from: DateTime!, $to: DateTime!) {
      user(login: $username) {
        contributionsCollection(from: $from, to: $to) {
          totalCommitContributions
          totalIssueContributions
          totalPullRequestContributions
          totalPullRequestReviewContributions
        }
      }
    }
    

提交回复
热议问题