feat: add personal contribution language stats#255
Open
andrecollar wants to merge 1 commit into
Open
Conversation
Add a new `personal_contributions` query parameter to the top-langs card. When enabled, language stats are computed from the user''s actual commit history (via the GitHub Search + Commits REST APIs) instead of repository ownership, making it useful for contributors who work mainly in organisations they do not own. New query parameters: - `personal_contributions=true` — enable the mode - `orgs` — comma-separated list of org logins to narrow the search - `personal_pages` — number of Search API pages to scan (max 10) - `personal_limit` — max commits to inspect (max 200) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
@andrecollar is attempting to deploy a commit to the martin-mfg's projects Team on Vercel. A member of the Team first needs to authorize it. |
Member
|
As mentioned in my previous comment, please use this file from GitHub for the language detection logic. This will ensure consistency with GitHub's language detection and is a comprehensive list of possible languages. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
personal_contributions=truequery parameter to the top-langs card that switches from repository-ownership-based stats to commit-history-based stats, using the GitHub Search and Commits REST APIs.personal-contribution-languages.js) that searches authored commits, filters generated/binary files, and aggregates language additions per commit.orgs(narrow search to specific orgs),personal_pages(Search API pages, max 10), andpersonal_limit(max commits to inspect, max 200).Motivation
The default top-langs card counts bytes across repositories the user owns. Contributors who work mainly inside organisations they do not own end up with misleading stats. This mode fixes that by looking at what languages actually appear in the user's commits.
Files changed
packages/core/src/fetchers/personal-contribution-languages.jspackages/core/src/api/top-langs.jspackages/core/tests/fetchPersonalContributionLanguages.test.jsTest plan
detectLanguage,shouldIgnoreFile,normalizePages,normalizeLimit, and the full fetch + aggregation flowResumo (PT/BR)
personal_contributions=trueao card de top-langs, que troca as estatísticas baseadas em posse de repositórios por estatísticas baseadas no histórico real de commits do usuário, usando as APIs REST de busca de commits do GitHub.personal-contribution-languages.js) que busca commits do usuário, filtra arquivos gerados/binários e agrega adições por linguagem.orgs(restringe a busca a organizações específicas),personal_pages(páginas da Search API, máx. 10) epersonal_limit(commits máximos a inspecionar, máx. 200).Motivação
O card padrão de top-langs conta bytes nos repositórios que o usuário possui. Contribuidores que trabalham principalmente em organizações que não são suas ficam com estatísticas enganosas. Este modo resolve isso olhando quais linguagens aparecem nos commits do usuário.
Plano de testes
detectLanguage,shouldIgnoreFile,normalizePages,normalizeLimite o fluxo completo de fetch + agregação