Skip to content
/ Stats Public template
forked from R055A/GitStats

Generate daily updated customizable visualizations of user and repository statistics from the GitHub GraphQL and REST APIs using GitHub Actions and Secrets

License

Notifications You must be signed in to change notification settings

lulunac27a/Stats

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

40 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“ˆ GitHub Stats Visualization πŸ”­

Generate daily updated visualizations of user and repository statistics from the GitHub GraphQL and REST APIs using GitHub Actions and Secrets. Customizable visualizations support dark and light mode and can adapt to device sizes.

A modification of jstrieb/github-stats visualizations with new and improved statistics and more options!

GitStats OverviewGitStats Languages

Note: my 'Avg contributions' stats is customized to only consider collaborative university project repos

Description of Statistical Terminology

GitHub Statistics Term Description
All-time GitHub contributions Count of all contributions (as defined by GitHub) to any and all repositories any time for a given user
Lines of code changes* Sum of all code additions and deletions to all repositories contributed to for a user, measured by lines
Avg contributions [weighted]* Average code changes per collaborative repository for a user [weighted relative to contributor count]
Repos contributed [% collab]* Count of all repositories contributed to by a user [including percent in collaboration with others]
Repo views (as of YYYY-MM-DD)* Sum of views to all repositories since created, if owned, or contributed to (from a given date)
Repo collaborators* Sum of collaborator and contributor counts for all repositories contributed to or owned for a user
Repo forks* Sum of all-time fork counts for all repositories contributed to or owned for a user
Repo stars* Sum of all-time star counts for all repositories contributed to or owned for a user
# [+#] Implemented Languages* Listed [and hidden] percentages of implemented languages relative to sizes of files contributed to

* Customisable as instructed in the πŸ” Options section below

πŸš€ Instructions

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

Copy Repository

  1. Click either link to start generating your own GitHub statistic visualizations:
    1. 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
    2. 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

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 "classic" token
    2. Ensure it is a "classic" token being generated and not a "fine-grained" token
    3. Name the token
    4. Select your preferred 'Expiration' date
    5. Select repo for 'Full control of private repositories'
    6. Select read:user to 'Read only ALL user profile data'
    7. Click the 'Generate token' button
    8. 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 the main):

        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: main from the 'Use workflow from' dropdown list
    4. Click the 'Run workflow' button
      • Note: this could take some time

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
      2. Overview statistics

Display Generated Statistics

  1. To display the generated statistics, static URLs can be used for images that are updated daily:
    1. For generated language statistics visualizations (replacing <username> with your GitHub username):
    ![](https://raw.githubusercontent.com/<username>/GitStats/actions_branch/generated_images/languages.svg)
    1. For generated overview statistic visualizations (replacing <username> with your GitHub username):
    ![](https://raw.githubusercontent.com/<username>/GitStats/actions_branch/generated_images/overview.svg)

πŸ” Options

Click drop-down to view optional repository Secrets for customizing GitHub statistic visualizations
  • Optional Secret Name: EXCLUDED

    For excluding repositories from being included entirely in the generated statistic visualizations.

    Instructions:

    • 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
  • Optional Secret Name: ONLY_INCLUDED

    For ONLY including repositories in the generated statistic visualizations

    • such as when there are fewer repositories to include than to exclude

    Instructions:

    • enter Value in the following format (separated by commas):
      • [owner/repo],[owner/repo],...,[owner/repo]
    • example:
      • R055A/GitStats,R055A/R055A
  • Optional Secret Name: EXCLUDED_LANGS

    For excluding undesired languages from being included in the generated statistic visualizations

    Instructions:

    • enter Value in the following format (separated by commas):
      • [language],[language],...,[language]
    • example:
      • HTML,Jupyter Notebook,Makefile,Dockerfile
  • Optional Secret Name: INCLUDE_FORKED_REPOS

    Boolean option for including forked repositories in the generated statistic visualizations. These could repeat statistical calculations

    • false by default

    Instructions:

    • enter Value in the following format:
      • <boolean>
    • examples:
      • true
  • Optional Secret Name: EXCLUDE_CONTRIB_REPOS

    Boolean option for excluding non-owned repositories contributed to in the generated statistic visualizations

    • false by default

    Instructions:

    • enter Value in the following format:
      • <boolean>
    • examples:
      • true
  • Optional Secret Name: EXCLUDE_ARCHIVE_REPOS

    Boolean option for excluding archived repositories in the generated statistic visualizations

    • false by default

    Instructions:

    • enter Value in the following format:
      • <boolean>
    • examples:
      • true
  • Optional Secret Name: EXCLUDE_PRIVATE_REPOS

    Boolean option for excluding private repositories in the generated statistic visualizations

    • for when you want to keep those secrets locked away from prying eyes
    • false by default

    Instructions:

    • enter Value in the following format:
      • <boolean>
    • examples:
      • true
  • Optional Secret Name: EXCLUDE_PUBLIC_REPOS

    Boolean option for excluding public repositories in the generated statistic visualizations

    • false by default

    Instructions:

    • enter Value in the following format:
      • <boolean>
    • examples:
      • true
  • Optional Secret Name: MORE_REPOS

    For including repositories that are otherwise not included in generated statistic visualizations when scraping by username

    • such as repositories imported from, say, GitLab - hint: add emails used in imported repo commits to profile settings

    Instructions:

    • enter Value in the following format (separated by commas):
      • [owner/repo],[owner/repo],...,[owner/repo]
    • example:
      • R055A/GitStats,R055A/R055A
  • Optional Secret Name: MORE_COLLABS

    For adding a constant value to the generated repository collaborators statistic

    • such as for collaborators that are otherwise not represented

    Instructions:

    • enter Value in the following format:
      • <int>
    • example:
      • 4
  • Optional Secret Name: ONLY_INCLUDED_COLLAB_REPOS

    For ONLY including collaborative repositories in the generated average contribution statistics calculations

    • such as when there are fewer collaborative repositories to include than to exclude

    Instructions:

    • enter Value in the following format (separated by commas):
      • [owner/repo],[owner/repo],...,[owner/repo]
    • example:
      • R055A/UniversityProject-A,R055A/UniversityProject-B
  • Optional Secret Name: EXCLUDED_COLLAB_REPOS

    For excluding collaborative repositories from being included in the average contribution statistics calculations

    • for example, such as for when
      • contributions are made to a collaborative repo, but it is not one of your projects (open-source typo fix, etc)
      • someone deletes and re-adds the entire codebase a few times too many
      • your or someone else's performance is not fairly represented - missing data bias
      • pirates, ninjas, etc.

    Instructions:

    • enter Value in the following format (separated by commas):
      • [owner/repo],[owner/repo],...,[owner/repo]
    • example:
      • tera_open_source/bit_typo_fix,peer_repo/missing_or_no_git_co_author_credit,dude_collab/email_not_reg_on_github,dog_ate/my_repo,mars/attacks
  • Optional Secret Name: MORE_COLLAB_REPOS

    For including collaborative repositories that are otherwise not included in the average contribution statistics calculations

    • for example, such as when
      • nobody even bothered to join the repository as a collaborator let alone contribute anything
      • the repository is imported and because it is ghosted there are no other contributions and, thus, none of the other collaborators are represented in the scraping

    Instructions:

    • enter Value in the following format (separated by commas):
      • [owner/repo],[owner/repo],...,[owner/repo]
    • example:
      • imported_ghosted/large_A+_collab_project,slave_trade/larger_A++_project
  • Optional Secret Name: STORE_REPO_VIEWS

    Boolean for storing generated repository view statistic visualization data beyond the 14 day-limit GitHub API allows

    • true by default

    Instructions:

    • enter Value in the following format:
      • <boolean>
    • examples:
      • false
  • Optional 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 and FIRST_VIEWED Secrets

    Instructions:

    • enter Value in the following format:
      • <int>
    • example:
      • 5000
  • Optional 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 and FIRST_VIEWED Secrets

    Instructions:

    • enter Value in the following format:
      • YYYY-MM-DD
    • example:
      • 2020-10-01
  • Optional 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 and LAST_VIEWED Secrets

    Instructions:

    • enter Value in the following format:
      • YYYY-MM-DD
    • example:
      • 2021-03-31

πŸ’š Support the Project

There are a few things you can do to support the project:

  • ✨ Star this repository (and/or 🌠 star jstrieb/github-stats and πŸ”­ follow jstrieb for more)
  • πŸ“ Report any bugs πŸ›, glitches, or errors that you find 🧐
  • πŸ’Έ Spare a donation to a worthy cause πŸ₯Ή

About

Generate daily updated customizable visualizations of user and repository statistics from the GitHub GraphQL and REST APIs using GitHub Actions and Secrets

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%