wyattowalsh docs
Data & MetricsFetch Metrics

Fetch Metrics

Fetches live GitHub GraphQL metrics — stars, commits, followers, repos — into a structured JSON file.

Module

scripts/fetch_metrics.py

Shared HTTP helpers live in scripts/_github_http.py (_headers, _graphql).

What it fetches

MetricSource
total_commitsGraphQL contributionCalendar
starsSum across all repos
contributions_last_yearGitHub contributions API
followers / followingUser profile
forksSum across all repos
network_countRepo network count
open_issues_countAll open issues
orgs_countOrganizations membership
watchersSum across all repos
reposPer-repo: name, stars, age_months, language
contributions_monthlyMonthly contribution breakdown

CLI

uv run python -m scripts.fetch_metrics \
  --owner wyattowalsh \
  --repo wyattowalsh \
  --output /tmp/metrics.json

Authentication

Requires GITHUB_TOKEN in the environment (PAT with read:user, public_repo):

export GITHUB_TOKEN=ghp_...
uv run python -m scripts.fetch_metrics --owner wyattowalsh --repo wyattowalsh --output metrics.json

Without a token, public API endpoints are used where possible (lower rate limits apply).

Output shape

{
  "total_commits": 5000,
  "stars": 150,
  "contributions_last_year": 800,
  "followers": 200,
  "forks": 40,
  "network_count": 100,
  "open_issues_count": 7,
  "orgs_count": 2,
  "watchers": 20,
  "repos": [
    { "name": "wyattowalsh", "stars": 50, "age_months": 36, "language": "Python" }
  ],
  "contributions_monthly": {
    "2026-01": 120,
    "2026-02": 95
  }
}

Caching

Results are cached in logs/json/YYYY-MM-DD.json (excluded from git via .gitignore). On the same day, the cached file is returned without hitting the API.