GitHub Stats Visualization

Generate daily updated visualizations of GitHub user and repository statistics from the GitHub API using GitHub Actions for any combination of private and public repositories, whether owned or contributed to – no server required.

GitStats Overview - LightGitStats Overview - DarkGitStats Languages - LightGitStats Languages - Dark

This is a modification of jstrieb/github-stats with many additional statistics, options and dark mode support

By default, statistical data for GitHub repositories an authenticated user either owns, has collaborative access to, or has otherwise contributed to are fetched from the GitHub API for visualization.

Forked repositories are excluded by default. However, there are many options provided for including or excluding any repository and more using: Statistics Options.

Regardless of which repositories are included, the generated All-time GitHub contributions given statistic will always represent all GitHub contributions by the user.

It seems that view and clone statistical data for repositories that an authenticated user neither owns nor has collaborative access to are not included in the generated statistics being visualized.

It also seems that statistics for contributions to GitHub repositories that an authenticated user neither owns nor has collaborative access to possibly only includes repositories that exist on GitHub before the contributions do. Contribution statistics for repositories uploaded to GitHub after the contributions are made, so long that the configured commit email is associated with the user’s GitHub account, can be included in the statistic visualizations by manually including the repository using the MORE_REPOS secret option in Statistics Options.

Instructions

Click to view step-by-step instructions for generating your own GitHub statistics visualizations

Copy Repository

  1. Click the link to: Create your own copy of this repository for viewing your GitHub stats

    • Note: the first GitHub Actions workflow initiated at creation of the copied repository is expected to fail

Generate a New Personal Access Token

  1. Generate a personal access token by following these steps:
    1. If you are logged in, click this link to: generate a new token
    2. Name the token
    3. Select your preferred ‘Expiration‘ date
    4. Select repo for ‘Full control of private repositories
    5. Select read:user to ‘Read ALL user profile data
    6. Click the ‘Generate token‘ button
    7. Copy the generated token – there is only one opportunity provided for this

Create ACCESS_TOKEN Secret

  1. Create a repository secret for the personal access token by following these steps:
    1. If this is your copy of the repository, click this link to: create a new secret
      • Otherwise, go to repository Settings, click the Secrets option, then click New repository secret
    2. Name the new secret: ACCESS_TOKEN
    3. Enter the generated personal access token as the ‘Value

Run GitHub Actions Workflow

  1. Manually generate GitHub statistics visualizations:
    1. This can be done using any of the following two GitHub Actions workflows:
      1. For the first time, or to reset stored statistics (although this is done with every push to master):

        This is required if the actions_branch branch is not created, as it is created when run

      2. Otherwise, for updating generated statistics visualizations (although this is automatically done daily):

        This requires the actions_branch branch to first be created with generated statistics visualizations

    2. With the GitHub Actions page open, click the ‘Run workflow‘ dropdown menu button
    3. Select Branch: master from the ‘Use workflow from‘ dropdown list
    4. Click the ‘Run workflow‘ button

View Generated Statistics

  1. Following the successful completion of a workflow, generated statistics visualizations can be viewed:
    1. In the generated_images directory in the actions_branch branch with the following image links:
      1. Language statistics using @media prefers-color-scheme for dark and light mode – not tested
      2. Language statistics in light mode only
      3. Language statistics in dark mode only
      4. Overview statistics using @media prefers-color-scheme for dark and light mode – not tested
      5. Overview statistics in light mode only
      6. Overview statistics in dark mode only

Display Generated Statistics

  1. To display the generated statistics, constant URLs can be used for images that are updated daily:
    1. For a GitHub profile README.md, attach #gh-light-mode-only and #gh-dark-mode-only to light and dark raw image links, respectively, such as:
      1. For generated language statistics visualizations (replacing
        with your GitHub username):

      <div class="highlight highlight-source-lisp position-relative overflow-auto" data-snippet-clipboard-copy-content="![](https://raw.githubusercontent.com//GitStats/actions_branch/generated_images/languagesLightMode.svg#gh-light-mode-only)![](https://raw.githubusercontent.com//GitStats/actions_branch/generated_images/languagesDarkMode.svg#gh-dark-mode-only)”>

      ![](https://raw.githubusercontent.com/
              /GitStats/actions_branch/generated_images/languagesLightMode.svg
              #gh-light-mode-only)![](https://raw.githubusercontent.com/
              
               /GitStats/actions_branch/generated_images/languagesDarkMode.svg
               #gh-dark-mode-only)