Skip to content

[BUG] TopRepos widget shows repositories with 0 commits in the selected time range as 'most active' #3248

Description

@Nareshkumawat-star

Describe the bug
The TopRepos.tsx widget is supposed to show "most active repos over any time range" (per README), but the current implementation fetches repos sorted by pushed_at or star count from GitHub's REST API — not by commit count within the selected 7d/14d/30d/90d window.

A repo the user hasn't touched in 6 months appears as "most active" simply because it has many stars or a recent push from a fork.

Expected behavior
Top Repos should rank by number of commits made by the authenticated user within the selected time range.

Fix approach

  1. For each repo, call GET /repos/{owner}/{repo}/commits?author={username}&since={startDate}
  2. Sort repos by commit count descending
  3. Show commit count badge next to each repo name
  4. Cache results in Supabase to avoid rate limit issues

Note: This is related to but distinct from issue #35 (repo filter on contribution chart) — that issue filters the chart by repo; this issue fixes the ranking logic in TopRepos.

File: src/app/api/metrics/repos/route.ts, src/components/TopRepos.tsx

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    staleInactive for 21+ days

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions