Skip to content
This repository has been archived by the owner on May 4, 2022. It is now read-only.

spences10/github-user-information

Repository files navigation

GitHub User Information

Show your GitHub languages used and contributions heatmap in a serverless generated image.

Uses OneGraph persisted query to pull GitHub GraphQL API user information.

Language split

Displays langauge split in a pie chart via the /pie.png endpoint by passing a GitHub username.

Example:

https://github-user-information.vercel.app/pie.png?username=spences10

Result:

a github users language split in a pie chart

There's also an interactive mode to explore the data, add the interactive parameter the the URL:

https://github-user-information.vercel.app/pie.png?username=spences10&interactive=true

Here's the GitHub API query, it's been stripped down from 100 to the last 20 repositories for performance.

Contributions heat map

Displays user GitHub contributions for the given year via the /heat.png endpoint.

Example:

https://ghui.vercel.app/heat.png?username=spences10&year=2021

Result:

Scott's GitHub contributions heatmap for 2021

There's also an interactive mode to explore the data, add the interactive parameter the the URL:

https://github-user-information.vercel.app/heat.png?username=spences10&interactive=true

Queries used

The GitHub queries look like this:

query GITHUB_USER_REPOSITORIES($username: String!) {
  gitHub {
    user(login: $username) {
      repositories(
        last: 20
        isFork: false
        orderBy: { field: UPDATED_AT, direction: ASC }
        privacy: PUBLIC
      ) {
        nodes {
          name
          description
          url
          updatedAt
          languages(first: 5) {
            nodes {
              color
              name
            }
          }
        }
      }
    }
  }
}

User contributions

query GITHUB_USER_CONTRIBUTIONS(
  $username: String!
  $year: GitHubDateTime!
) {
  gitHub {
    user(login: $username) {
      contributionsCollection(from: $year) {
        contributionCalendar {
          totalContributions
          weeks {
            contributionDays {
              color
              contributionCount
              date
              weekday
            }
          }
        }
      }
    }
  }
}

Charts

Great resource with suggestions here: https://www.monterail.com/blog/javascript-libraries-data-visualization

This helped when I installed Puppeteer ans Vercel didn't recognise the dependency: alixaxel/chrome-aws-lambda#172