Skip to content

StefVuck/Github-Language-Stats

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

Automatically generate visualizations of your programming language usage across all your GitHub repositories.

Why This Action?

Building on other tools, this runs "locally" as an action, allowing quicker refreshes, and works far better for those who enjoy a wide range of languages

  • Analyzes ALL your languages, not just the top 6
  • Works with both public and private repositories
  • Highly configurable to match your needs
  • Generates multiple visualization types with modern design

Setup

1. Create a Personal Access Token

The action requires a Personal Access Token (PAT) to access your repositories.

  1. Go to https://github.com/settings/tokens
  2. Click "Generate new token (classic)"
  3. Name: Language Stats
  4. Select scope: repo (Full control of private repositories)
  5. Click "Generate token" and copy it

2. Add Token as Secret

  1. Go to your repository Settings
  2. Secrets and variables → Actions
  3. Click "New repository secret"
  4. Name: STATS_TOKEN
  5. Value: Paste your PAT
  6. Click "Add secret"

3. Create Workflow

Create .github/workflows/stats.yml:

name: Update Language Statistics

on:
  schedule:
    - cron: "0 0 * * *"
  workflow_dispatch:

permissions:
  contents: write

jobs:
  update-stats:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: StefVuck/Github-Language-Stats@v1.2.0
        with:
          github_token: ${{ secrets.STATS_TOKEN }}
          visualization_types: "leaderboard"
          output_path: "stats"

4. Add to README

![Language Stats](stats/leaderboard_by_lines.png)

Examples

Leaderboard with Breakdown

Shows top languages with contribution breakdown from your top repositories.

Light Mode: Leaderboard Light

Dark Mode: Leaderboard Dark

Bar Charts

Light Mode: Bar Chart Light

Dark Mode: Bar Chart Dark

Pie Charts

Light Mode: Pie Chart Light

Dark Mode: Pie Chart Dark

Donut Charts

Light Mode: Donut Chart Light

Dark Mode: Donut Chart Dark

With vs Without Language Filtering

Excluding HTML/CSS: Filtered

Including All Languages: All Languages

Configuration

Input Description Default
github_token Personal Access Token with repo scope Required
visualization_types Types to generate leaderboard bar pie
output_path Output directory github-stats
exclude_repos Comma-separated repos to skip ''
include_forks Include forked repos false
exclude_languages Comma-separated languages to skip HTML,CSS
top_repos_count Repos shown in leaderboard breakdown 5
commit_message Git commit message Update language statistics
dark_mode Enable dark mode theme false
use_loc Count actual lines of code by cloning repos. Slower but more accurate. false

Visualization Types

  • leaderboard - Horizontal bars with badges and top contributing repos
  • bar - Vertical bars (top 12 languages)
  • horizontal-bar - Horizontal bars (top 15 languages)
  • pie - Pie chart (top 8 + "Other")
  • donut - Donut chart (top 8 + "Other")

Output Files

Each type generates 3 files:

  • *_by_repos.png - Sorted by repository count
  • *_by_bytes.png - Sorted by code volume (bytes from GitHub API, or lines of code with use_loc: 'true')
  • *_by_weighted.png - Balanced ranking combining repos and volume

Advanced Configuration

- uses: StefVuck/Github-Language-Stats@v1.2.0
  with:
    github_token: ${{ secrets.STATS_TOKEN }}
    visualization_types: "leaderboard bar pie donut"
    output_path: "language-stats"
    exclude_repos: "test-repo,old-project"
    include_forks: "true"
    exclude_languages: "HTML,CSS,Markdown"
    top_repos_count: "10"
    dark_mode: "true"
    use_loc: "true"

Troubleshooting

403 Forbidden Error

If you see Resource not accessible by integration, your token doesn't have the required permissions.

Solution: Create a Personal Access Token with repo scope (see Setup above).

Images Not Committing

Ensure your workflow has contents: write permission and the output directory is not in .gitignore.

Local Development

python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
cp config.example.json config.json
# Edit config.json with your token
python main.py --types leaderboard bar pie --dark-mode

# Use actual lines of code instead of byte counts (slower)
python main.py --types leaderboard --loc

License

MIT

About

Better Language Stats of your Private AND Public repos for your Readme/Project.

Topics

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors