fetch_repo_data.ts

view source

Declarations
#

2 declarations

fetch_repo_data
#

fetch_repo_data.ts view source

(options: FetchRepoDataOptions): Promise<RepoJson[]> import {fetch_repo_data} from '@fuzdev/fuz_repos/fetch_repo_data.js';

Fetches GitHub metadata (CI status, PRs) for all repos.

Fetches sequentially with a delay before each request to respect GitHub API rate limits. Uses await_in_loop intentionally to avoid parallel requests overwhelming the API. CI status is read for the branch each repo's registry entry follows (main when it names none), and that branch is written to RepoJson.branch.

A repo whose registry entry declares no CI (ci: false) isn't asked for check runs, and one with none on its branch isn't a failure: both leave check_runs null without logging. A failed fetch is logged as an error and leaves null for that repo's check_runs or pull_requests, and the remaining repos still fetch — except a 401 response or a repo URL without a GitHub owner, which throw.

options

the repos, credentials, cache, and pacing

returns

Promise<RepoJson[]>

a RepoJson for each repo, in the order given

throws

  • Error - on a 401 response (check `SECRET_GITHUB_API_TOKEN`) or a repo whose URL has no GitHub owner

FetchRepoDataOptions
#

fetch_repo_data.ts view source

FetchRepoDataOptions import type {FetchRepoDataOptions} from '@fuzdev/fuz_repos/fetch_repo_data.js';

Options for fetch_repo_data.

local_repos

The repos to fetch GitHub metadata for, in order.

type LocalRepo[]

token?

GitHub API token, sent with each request.

type string

cache?

Response memoization, from fuz_util's fetch.ts.

type Map<string, { key: string; url: string; params: any; value: any; etag: string | null; last_modified: string | null; }>

log?

type Logger

delay?

Milliseconds to wait before each API request. Defaults to 33.

type number

github_api_version?

Sent as the x-github-api-version header when set.

type string

fetch?

The fetch the API requests go through. Defaults to globalThis.fetch.

type { (input: RequestInfo | URL, init?: RequestInit | undefined): Promise<Response>; (input: string | Request | URL, init?: RequestInit | undefined): Promise<...>; }

Depends on
#

Imported by
#