Skip to content

A simple Ruby Gem to give you some stats about your repos.

License

Notifications You must be signed in to change notification settings

GitHubToolbox/github-repo-stats

Repository files navigation

DevelopersToolbox logo
Github Build Status Release Commits since release

Overview

Ghstats is a small command line tool to retrieve a set of stats for a given set of repositories, It allows you to get stats for all repositories owned by a named user or users, or from an organisation or organisations.

To make the reporting as fast as possible we make extensive use of the Parallel gem to run as many clones as possible in parallel.

Tokens

There is no requirement to supply a token when using ghstats, however there are numerous benefits. including but not limited to:

  1. Less impact from connection throttling (Unauthenticated connections are throttled more heavily by GitHub)
  2. Ability to get stats for private repositories
  3. Simple to report on all of your own repositories (no need to specify a username)

You could for example get stats for ALL the repositories that you own with a single command.

# ghstats -t <Your token goes here> -A

If you just wanted your personal repositories you could use -U instead of -A, or -M if you just wanted the repositories for organisations that you are a member of.

If you do not supply token you will be limited to reporting on just public repositories.

No Passwords?

We intentionally do NOT handle username + password combinations when talking to GitHub, this removes some security risks and also removes the issue of having to handle MFA logins. It allows you to create a read-only token for cloning only to further improve your security position.

Example

The following is an example of how to get stats about all public repositories owned by Wolf Software.

# ghstats -o WolfSoftware

Usage

Usage: ghstats
    -h, --help                       Display this screen

Access Parameters:
    -t, --token <token>              GitHub personal access token (PAT)

Report Parameters:
    -u, --user <names>               Github username(s) to rip
    -o, --org <names>                Github organisation(s) to rip
    -U, --user-repos                 Rip all of the repositories for the named user(s)
    -M, --org-member-repos           Rip all of the repositories for all organisation the user(s) is a member of
    -A, --all-repos                  Same as running -U -M
    -O, --org-repos                  Rip all of the repositories for the named organisation(s)

Report Flags:
    -P, --public-only                Only use public repos

If you just supply a username and nothing else it will default to just the users own repositories (same as -U)

Default Values

Option Name Default Value Purpose
-t, --token No default The token used to authenticate yourself (not required but helps remove/mitigate throttling issues)
-u, --user No default The user(s) you wish to rip the repo of (if not supplied defaults to yourself IF a token is used)
-o, --org No default The organisation(s) you want to rip the repos of
-U, --user-repos False Download all repositories belonging to the named user(s)
-M, --org-member-repos False Download all repositories belonging to any organisation the named user(s) is a member of
-A, --all-repos False Works the same as --user-repo and --org-member-repos combined
-O, --org-repos False Download all repositories belonging to the named organisation(s)
-P, --public-only False Only display stats for public repos (default is all visible repos - includes private if a token is supplied)

users and orgs can be either a single entry or comma-separated list of entries.

Error Handling

All errors raised from github-core-lister are caught and re-thrown as StandardErrors in order to simplify the catching.

About

A simple Ruby Gem to give you some stats about your repos.

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

Packages

No packages published