Skip to content

fetchOrgActivity

The fetcher behind the organization activity card.

What an organization did over a window: pull requests, issues and discussions, and the commits behind them when they are asked for.

Every count but the commits rides on one GraphQL request — an aliased search per figure, which costs a single rate-limit point however many of them the card ends up drawing. The commits are a REST search of their own, so they are only fetched when asked for.

A count covers the organization's public repositories, plus whatever private ones the token can see: a search answers what its token is allowed to find.

fetchOrgActivity(options, config: CardConfig): Promise<OrgActivityData>
OptionTypeRequiredWhat it is
orgstring | undefinedyes—
daysnumber | undefinednoDays the window covers, ending today; out of range or unparsed, the default stands.
fromDate | undefinednoThe start of the window, instead of days.
toDate | undefinednoThe end of the window, instead of days.
include_commitsboolean | undefinedno—
require_issuesboolean | undefinednoWhether refused issue counts fail the whole fetch rather than dropping the two stats.
The card draws both rows unless hide names them, so a caller that wants neither
turns this off and gets the rest of the card from a token that may not read issues.

Returns Promise<OrgActivityData> — The counts, and the window they cover.

The login is the name in github.com/<org>, and it is checked against GitHub’s own login shape before any request is made. A login that resolves to nothing — or to a user rather than an organization — is a not_found.

days is counted back from today, both ends inclusive, so days: 1 is today alone and the default 30 is today and the 29 days before it. It is a rolling window rather than a fixed range: the card says what it is showing, and the numbers move with the calendar.

Every end is a UTC date, because a date is all a search qualifier reads.

Every count but the commits is an aliased search on one GraphQL request, and GitHub charges that request a single rate-limit point however many searches ride on it — so the card’s shape does not change what it costs.

The commits are the exception. GitHub’s GraphQL search has no commit index, so include_commits adds a REST commit search, which is a second request against a much smaller allowance (30 a minute). It is off unless asked for, and a refusal drops the count to null rather than failing the card that is already fetched.

A search answers what its token is allowed to find, so a token with access to the organization’s private repositories counts those too. The same query with a token that has none counts only the public ones. That is GitHub’s behaviour rather than a choice made here — but it means two deployments can honestly draw different numbers for the same organization.