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>| Option | Type | Required | What it is |
|---|---|---|---|
org | string | undefined | yes | — |
days | number | undefined | no | Days the window covers, ending today; out of range or unparsed, the default stands. |
from | Date | undefined | no | The start of the window, instead of days. |
to | Date | undefined | no | The end of the window, instead of days. |
include_commits | boolean | undefined | no | — |
require_issues | boolean | undefined | no | Whether 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
Section titled “The login”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.
The window
Section titled “The window”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.
What it costs
Section titled “What it costs”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.
What a search can see
Section titled “What a search can see”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.