Lines of Code badge (GitHub Action)
Lines of Code badge (GitHub Action)
Role
A GitHub Action runs on every push to main, recomputes the repo's
total line count, regenerates an SVG badge, and commits the badge
back to the repo. The badge is referenced from each README's
heading block alongside the existing quality / coverage badges:
<!-- TODO: broken link, was [ -->](#)
Every repo's README ships the badge by default via
templates/per-site-ci/; new family repos pick it up automatically.
Free tier
Free OSS Action, runs on the family's existing GitHub Actions free public-repo minutes — unlimited under the public-everywhere posture.
Card / subscription required?
NO. GitHub Action; consumes Actions free minutes.
Alternatives
- shields.io dynamic badge driven by the Tokei JSON artefact URL — works but ties the badge to a remote service that has to fetch the artefact each render (rate-limited).
- Self-rendered SVG generated in-repo by a Python or Node script — same approach, more code to maintain.
- Skip the badge and link directly to the family /stats page — rejected because the README badge is the cheapest at-a-glance signal.
Swap cost
Low. Replace the Action workflow YAML; the badge consumer (README markdown) doesn't change.
Why this is our pick
The 9-tool code-stats stack (decision) asks for a visible line-count signal in every repo's README — a self-committing GitHub Action gives that for free, without depending on a remote SVG host or a third-party badge service.
Composes with Tokei for the canonical line count + the family-wide /stats page for the cross-repo aggregate view. The badge is the per-repo glance; /stats is the family-wide dashboard.
Auto-tracked end-to-end: badge regenerates on every push without
human action, in line with the
auto-only-tracking rule.