GitHub Stats Visualization
Generate daily updated visualizations of user and repository statistics from the GitHub GraphQL and REST APIs using GitHub Actions and Secrets for any combination of private and public repositories - dark mode supported.
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
- Click either link to start generating your own GitHub statistic visualizations:
- Generate your own copy of this repository without the commit history
- Note: the first GitHub Actions workflow initiated at creation of the copied repository is expected to fail
- Fork a copy of this repository with the commit history configured to sync changes
- Note: this copies all branches including the
action_branch
with statistics, but this can be overwritten
- Note: this copies all branches including the
- Generate your own copy of this repository without the commit history
Generate a New Personal Access Token
- Generate a personal access token by following these steps:
- If you are logged in, click this link to: generate a new token
- Otherwise, to learn how to generate a personal access token: read these instructions
- Name the token
- Select your preferred 'Expiration' date
- Select
repo
for 'Full control of private repositories' - Select
read:user
to 'Read ALL user profile data' - Click the 'Generate token' button
- Copy the generated token - there is only one opportunity provided for this
- If you are logged in, click this link to: generate a new token
Create ACCESS_TOKEN Secret
- Create a repository secret for the personal access token by following these steps:
- 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
- Name the new secret:
ACCESS_TOKEN
- Enter the generated personal access token as the 'Value'
- If this is your copy of the repository, click this link to: create a new secret
Run GitHub Actions Workflow
- Manually generate GitHub statistics visualizations:
- This can be done using any of the following two GitHub Actions workflows:
- For the first time, or to reset stored statistics (although this is done with every push to master):
- Click the link to: go to the Generate Git Stats Images GitHub Actions workflow
This is required if the
actions_branch
branch is not created, as it is created when run - Otherwise, for updating generated statistics visualizations (although this is automatically done daily):
- Click the link to: go to the Auto Update Stats Images GitHub Actions workflow
This requires the
actions_branch
branch to first be created with generated statistics visualizations
- For the first time, or to reset stored statistics (although this is done with every push to master):
- With the GitHub Actions page open, click the 'Run workflow' dropdown menu button
- Select
Branch: master
from the 'Use workflow from' dropdown list - Click the 'Run workflow' button
- This can be done using any of the following two GitHub Actions workflows:
View Generated Statistics
- Following the successful completion of a workflow, generated statistics visualizations can be viewed:
- In the
generated_images
directory in theactions_branch
branch with the following image links:- Language statistics using @media prefers-color-scheme for dark and light mode - not tested
- Language statistics in light mode only
- Language statistics in dark mode only
- Overview statistics using @media prefers-color-scheme for dark and light mode - not tested
- Overview statistics in light mode only
- Overview statistics in dark mode only
- In the
Display Generated Statistics
- To display the generated statistics, constant URLs can be used for images that are updated daily:
- 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:- For generated language statistics visualizations (replacing
![](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) - For generated overview statistic visualizations (replacing
![](https://raw.githubusercontent.com/
/GitStats/actions_branch/generated_images/overviewLightMode.svg #gh-light-mode-only)![](https://raw.githubusercontent.com/ /GitStats/actions_branch/generated_images/overviewDarkMode.svg #gh-dark-mode-only) - For generated language statistics visualizations (replacing
- For websites, use the raw image URLs for any suitable image from the above View Generated Statistics links.
Note: I have not used the images on any website other than the following GitHub pages:
- For a GitHub profile README.md, attach
Statistics Options
Click to view Repository Secrets for customizing GitHub statistic visualizations
- Secret Name:
EXCLUDED
- for excluding listed repositories from being included in the generated statistic visualizations
- enter Value in the following format (separated by commas):
[owner/repo],[owner/repo],...,[owner/repo]
- example:
jstrieb/github-stats,rahul-jha98/github-stats-transparent,idiotWu/stats
- Secret Name:
ONLY_INCLUDED
- for ONLY including listed repositories in the generated statistic visualizations
- enter Value in the following format (separated by commas):
[owner/repo],[owner/repo],...,[owner/repo]
- example:
R055A/GitStats,R055A/R055A
- Secret Name
EXCLUDED_LANGS
- for excluding listed languages from being included in the generated statistic visualizations
- enter Value in the following format (separated by commas):
[language],[language],...,[language]
- example:
HTML,Jupyter Notebook,Makefile,Dockerfile
- Secret Name
INCLUDE_FORKED_REPOS
- for including forked repositories in the generated statistic visualizations
false
by default
- enter Value in the following format:
- examples:
true
- for including forked repositories in the generated statistic visualizations
- Secret Name
EXCLUDE_CONTRIB_REPOS
- for excluding repositories (pull request) contributed to in the generated statistic visualizations
false
by default
- enter Value in the following format:
- examples:
true
- for excluding repositories (pull request) contributed to in the generated statistic visualizations
- Secret Name
EXCLUDE_ARCHIVE_REPOS
- for excluding archived repositories in the generated statistic visualizations
false
by default
- enter Value in the following format:
- examples:
true
- for excluding archived repositories in the generated statistic visualizations
- Secret Name
EXCLUDE_PRIVATE_REPOS
- for excluding private repositories in the generated statistic visualizations
false
by default
- enter Value in the following format:
- examples:
true
- for excluding private repositories in the generated statistic visualizations
- Secret Name
EXCLUDE_PUBLIC_REPOS
- for excluding public repositories in the generated statistic visualizations
false
by default
- enter Value in the following format:
- examples:
true
- for excluding public repositories in the generated statistic visualizations
- Secret Name
MORE_REPOS
- for including repositories that are otherwise not included in the generated statistic visualizations
- such as imported repositories with contributions
- enter Value in the following format (separated by commas):
[owner/repo],[owner/repo],...,[owner/repo]
- example:
R055A/GitStats,R055A/R055A
- for including repositories that are otherwise not included in the generated statistic visualizations
- Secret Name
MORE_COLLABS
- for adding a constant value to the generated repository collaborators statistic
- such as for collaborators that are otherwise not represented
- enter Value in the following format:
- example:
4
- for adding a constant value to the generated repository collaborators statistic
- Secret Name
STORE_REPO_CLONES
- for storing generated repository clone statistic visualization data beyond the 14 day-limit GitHub API allows
true
by default
- enter Value in the following format:
- examples:
false
- for storing generated repository clone statistic visualization data beyond the 14 day-limit GitHub API allows
- Secret Name
STORE_REPO_VIEWS
- for storing generated repository view statistic visualization data beyond the 14 day-limit GitHub API allows
true
by default
- enter Value in the following format:
- examples:
false
- for storing generated repository view statistic visualization data beyond the 14 day-limit GitHub API allows
- Secret Name
REPO_VIEWS
- for adding a constant value to the generated repository view statistics
- such as for when the stored data is reset or when importing stat data from elsewhere
- requires being removed within 14 days after the first workflow is run (with
LAST_VIEWED
) - requires corresponding
LAST_VIEWED
andFIRST_VIEWED
Secrets
- enter Value in the following format:
- example:
5000
- for adding a constant value to the generated repository view statistics
- Secret Name
LAST_VIEWED
- for updating the date the generated repository view statistics data is added to storage from
- such as for when the stored data is reset or when importing stat data from elsewhere
- requires being removed within 14 days after the first workflow is run (with
REPO_VIEWS
) - may require corresponding
REPO_VIEWS
andFIRST_VIEWED
Secrets
- enter Value in the following format:
YYYY-MM-DD
- example:
2020-10-01
- for updating the date the generated repository view statistics data is added to storage from
- Secret Name
FIRST_VIEWED
- for updating the 'as of' date the generated repository view statistics data is stored from
- such as for when the stored data is reset or when importing stat data from elsewhere
- may require corresponding
REPO_VIEWS
andLAST_VIEWED
Secrets
- enter Value in the following format:
YYYY-MM-DD
- example:
2021-03-31
- for updating the 'as of' date the generated repository view statistics data is stored from
- Secret Name
REPO_CLONES
- for adding a constant value to the generated repository clone statistics
- such as for when the stored data is reset or when importing stat data from elsewhere
- requires being removed within 14 days after the first workflow is run (with
LAST_CLONED
) - requires corresponding
LAST_CLONED
andFIRST_CLONED
Secrets
- enter Value in the following format:
- example:
2500
- for adding a constant value to the generated repository clone statistics
- Secret Name
LAST_CLONED
- for updating the date the generated repository clone statistics data is added to storage from
- such as for when the stored data is reset or when importing stat data from elsewhere
- requires being removed within 14 days after the first workflow is run (with
REPO_CLONES
) - may require corresponding
REPO_CLONES
andFIRST_CLONED
Secrets
- enter Value in the following format:
YYYY-MM-DD
- example:
2020-10-01
- for updating the date the generated repository clone statistics data is added to storage from
- Secret Name
FIRST_CLONED
- for updating the 'as of' date the generated repository clone statistics data is stored from
- such as for when the stored data is reset or when importing stat data from elsewhere
- may require corresponding
REPO_CLONES
andLAST_CLONED
Secrets
- enter Value in the following format:
YYYY-MM-DD
- example:
2021-04-01
- for updating the 'as of' date the generated repository clone statistics data is stored from
Support the Project
There are a few things you can do to support the project:
- Star the repository (and follow me and/or
jstrieb
on GitHub for more) - Share and upvote on sites
- Report any bugs, glitches, or errors that you find
- Spare a donation to a worthy cause
Related Projects
- The repository this modifies is also inspired by a desire to improve upon anuraghazra/github-readme-stats
- More influencing repositories, also modifications of
jstrieb/github-stats
are: - Makes use of GitHub Octicons to precisely match the GitHub UI