DEV Community

Cover image for Automated GitHub repo stats as SVG in the README
FSCSS for ProvChart

Posted on

Automated GitHub repo stats as SVG in the README

Most README “stats” badges are either fixed images or another third-party widget. I wanted something simpler: read the repo from GitHub’s API, turn the numbers into SVG files in the repo, embed them like any image.

That’s what ProvChart Repo Stats does.

What it writes

File Content Default chart
docs/charts/repo-overview.svg Stars, forks, watchers, open issues area (real counts)
docs/charts/languages.svg Language share hbar

No hand-maintained chart JSON for those two.

Setup

  1. Add a repo secret PROVCHART_API_KEY (key from chart.devtem.org/dashboard).
  2. Workflow:
name: Repo stats charts

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

permissions:
  contents: write

jobs:
  charts:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - uses: fscss-ttr/provchart-repo-stats@v1.3
        with:
          api-key: ${{ secrets.PROVCHART_API_KEY }}
        env:
          PROVCHART_API_KEY: ${{ secrets.PROVCHART_API_KEY }}

      - uses: stefanzweifel/git-auto-commit-action@v5
        with:
          commit_message: "chore: update repo stats charts"
          file_pattern: "docs/charts/*.svg"
Enter fullscreen mode Exit fullscreen mode
  1. README:
![Overview](./docs/charts/repo-overview.svg)
![Languages](./docs/charts/languages.svg)
Enter fullscreen mode Exit fullscreen mode

Run the workflow once (or wait for the schedule). The SVGs commit back; the README stays normal Markdown.

Defaults worth knowing

  • Overview uses real counts (not forced to 0–100).
  • Languages use share %.
  • You can switch types (overview-type, languages-type) if you prefer bars.

Charts are generated with ProvChart (generate-svg). Related: provchart-readme-action if you already have a .provchart/charts.json and want fixed sample charts instead of live repo metrics.

Feedback and issues: github.com/fscss-ttr/provchart-repo-stats.


Top comments (0)