Giter VIP home page Giter VIP logo

gitstats's Introduction

๐Ÿ“ˆ 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 collaborative contributions' stats is customized to only consider collaborative uni project repos

๐Ÿš€ 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 ๐Ÿฅน

gitstats's People

Contributors

boidolr avatar r055a avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

gitstats's Issues

Improve Issue and PR stats

Improve the fetching of Issue and PR fetched statistics to include all Issues (open and closed) which a user has any relevant involvement in, such as whether by creating, commenting, being assigned, etc.

Also, optimize so to use as little fetching as possible while maintaining improved statistics

Add workflow dispatch

Add a workflow dispatch event to the scheduled workflow for daily automatic updating of the stat images.

Add repositories manually

Include an option to manually add repositories if contributions to these are not being represented in the statistics, such as when a repository is imported, for example.

Fix last view/clone date update

Currently, it updates the last date that there was a view/clone rather than the last date views/clones are updated, or rather the day before the last date they are updated as views/clones for all dates prior to the date they are updated are stored to DB/ENV while the views/clones for the day they are updated are then added to the values stored to DB for displaying in the generated images. Without this fix, a last view/clone date could potentially be earlier than a first view/clone date.

Bug: SVG responsive design

The generated SVG for at least the language statistics does not adjust well when using a mobile device.

The SVG templates can be found here

Refactor Statistical Visualizations

  • Reduce SVG height for each visualization.
  • Reduce Overview.svg width
  • Increase Languages.svg width
  • Rearrange Overview.svg text rows so user statistics are all before repository statistics in descending order
  • Merge Forks and Stars into a single text row
    • display values for each side-by-side separated by a |
    • rename: Repository Forks .. Stars...
  • Merge Pull Requests and Issues into a single text row
    • display values for each side-by-side separated by a |
  • Display Pull request and Issues statistics for users instead or repositories
  • Remove repository Clones statistics
  • Remove redundant repository Contributors statistic (already represented in Collaborators)
  • Change Languages.svg dp from 3 to 2
  • Update README.md to reflect changes

Bug: SVG text white space preservation

Want to preserve white spaces in the following text in the overview.svg template:

  • Pull requests and issues:
    Pull requests . . . . . . | . should be: Pull requests |
  • Repository forks and stars:
    Repository forks . . . | . should be: Repository forks |

Current failed attempt due to conflict:

  • Including xml:space="preserve" to foreignObject, such as:
    <foreignObject x="21" y="21" width="335.5" height="208" xml:space="preserve">

Fix workflow schedule

The GitHub workflow for daily automatic updating of the stat images should only run on schedule and not when changes are pushed to the master branch.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.