uncenter / gh-stats

📊 GitHub stats in SVGs. Maintained, full of features, (mostly) bug free.
GNU General Public License v3.0
1 stars 0 forks source link
github-stats svg

gh-stats

Code style: black

A workflow that generates various statistics about my GitHub activity in the form of SVGs. Check out the original project (GitHub Stats Visualization) and idiotWu's more updated fork that served as the basis for some of the changes I made.

Dark Light

Features

Usage

Clone this repository without the Git history and create a new GitHub repository for it.

git clone --depth 1 https://github.com/uncenter/gh-stats.git

Adjust settings/options via environment variables in .github/workflows/main.yml to your liking (see Options). You'll need to generate a personal access token for the workflow to succeed:

  1. Click this link: generate a new "classic" token (if you are not logged in, follow these instructions).
  2. Ensure you select "classic" token type.
  3. Name the token.
  4. Set your preferred 'Expiration' date (no expiration if you want to just set and forget).
  5. Select repo (full control of private repositories) and read:user (read-only access to all user profile data).
  6. Click the 'Generate token' button.
  7. Copy the generated token - this is the one and only time to copy it.

You'll then need to create a new repository secret for this token:

  1. Go to the Settings tab of the repository, click the Secrets and variables item on the side panel, click Actions in the expanded dropdown, and then click the green New repository secret button.
  2. Name the new secret ACCESS_TOKEN.
  3. Enter the personal access token from the previous step as the value and click Add secret.

Options

Option Description Usage Example
EXCLUDED Exclude certain repositories by specifying their usernames and repository names as a comma-separated list. someone/repository,another-person/another-repository
EXCLUDED_LANGS Ignore certain languages by specifying them as a comma-separated list. Languages are not case-sensitive. html,css
EXCLUDE_FORKED_REPOS Show statistics only for "owned" repositories and exclude forks with contributions. true
EXCLUDE_PRIVATE_REPOS Show statistics for only public repositories and exclude your private ones. true
GENERATED_IMAGE_NAME Customize the output path for generated images. Make sure to end with the .svg extension and keep the {{ template }} and {{ theme }} variables somewhere in the name. There are three templates - overview, languages, community - and two themes - light and dark. {{ template }}-{{ theme }}.svg

To use these options, add a new secret with the specified name and value to your repository's secrets, similar to how you added the access token secret. If you prefer not to use secrets, you can directly set the values in the workflow file by replacing VARIABLE_NAME: ${{ secrets.VARIABLE_NAME }} with the desired value (e.g., VARIABLE_NAME: true). For options that accept lists of values, provide the values as comma-separated strings within a single string. Make sure not to separate values with spaces though - apples,oranges works but apples, oranges will not.