Skip to content

Instantly share code, notes, and snippets.

@rafaeldelboni
Last active November 28, 2025 17:17
Show Gist options
  • Select an option

  • Save rafaeldelboni/4f269b696edbe48c310e7edb918df9a7 to your computer and use it in GitHub Desktop.

Select an option

Save rafaeldelboni/4f269b696edbe48c310e7edb918df9a7 to your computer and use it in GitHub Desktop.
Year on Github

Fetch Your Year of GitHub Contributions

I was struggling to kick off my self-assessment feedback for the year, so I came up with an idea to use the GitHub API to provide relevant data and jumpstart my writing process.

Query

I started with this simple query:

query userInfo($login: String!) {
  user(login: $login) {
    name
    repositoriesContributedTo(
      first: 100
      includeUserRepositories: true
      contributionTypes: [COMMIT, ISSUE, PULL_REQUEST, REPOSITORY]
    ) {
      totalCount
      pageInfo {
        endCursor
        hasNextPage
      }
      nodes {
        nameWithOwner
        description
      }
    }
    contributionsCollection(
      from: "2024-11-28T00:00:00.000Z"
      to: "2025-11-28T23:59:59.999Z"
    ) {
      commitContributionsByRepository(maxRepositories: 100) {
        repository {
          nameWithOwner
          description
        }
        contributions(first: 100) {
          totalCount
        }
      }
      pullRequestContributionsByRepository(maxRepositories: 100) {
        repository {
          nameWithOwner
          description
        }
        contributions(first: 100) {
          totalCount
        }
      }
      issueContributionsByRepository(maxRepositories: 100) {
        repository {
          nameWithOwner
          description
        }
        contributions(first: 100) {
          totalCount
        }
      }
      totalCommitContributions
      totalIssueContributions
      totalPullRequestContributions
      totalPullRequestReviewContributions
      totalRepositoryContributions
    }
  }
}

Fetching

Since the online Explorer is gone you will need an Graphlq query or a curl to do so, you can also use the gh cli like so:

gh api graphql -F login='your-gh-handle' --paginate --slurp -f query='query userInfo($login: String!) { ... }'

Note: Don’t forget to add the query variables:
{ "login": "your-gh-handle" }

This query provides a JSON output containing your contributions, including commits, pull requests, repository names, and descriptions. It's a great starting point for building a detailed self-assessment based on your activity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment