Skip to content

fetchContributedTo

The fetcher behind the contributed-to card.

Rank the repositories a user has contributed to, most contributions first.

from and to narrow the walk to the range they name, so the ranking, the totals and the year marks all cover that range and nothing else. A range the account contributed in no year of draws an empty card rather than an error.

Ties keep the walk's order, which is chronological: the repository first seen in the earliest range comes first.

An excluded repository is dropped before the total is counted, so the footer's "top n of m" never counts one the card was told not to show.

fetchContributedTo(options, config: CardConfig): Promise<ContributedToData>
OptionTypeRequiredWhat it is
usernamestring | undefinedyes
include_own_reposboolean | undefinedno
repos_countnumber | undefinednoRows to rank; out of range or unparsed, the default stands.
exclude_repostring[] | undefinednoEach entry is an owner/name or a bare name.
fromDate | undefinednoStart of the range to walk; as early as GitHub goes when absent.
toDate | undefinednoEnd of that range.

Returns Promise<ContributedToData> — The ranked slice, and the totals it was taken from.

Both ends are inclusive, and an omitted end is filled with the widest range GitHub will answer for. A contributionsCollection spans at most a year, so the range is sliced into one per calendar year and the slices are sent as fields of a single request — one rate-limit point for the whole span rather than one per year.

Repositories come back most-contributions-first, with the years each one saw. repos_count caps the list; include_own_repos decides whether the user’s own repositories are in it at all, and they are not by default.