Skip to main content

Module github

Module github 

Source
Expand description

GitHub backend — works against GitHub Cloud (api.github.com) and GitHub Enterprise (<enterprise-host>/api/v3).

§Dependency choice

The v0.1 spec suggested octocrab as the HTTP client. This implementation goes direct on reqwest instead, for three reasons:

  1. Lighter dependency graph — octocrab pulls in ~30 transitive crates including WebSocket plumbing we don’t use.
  2. octocrab does not cleanly expose a streaming asset download (the spec requires AsyncRead, not a Bytes blob).
  3. We need precise control over rate-limit header parsing to populate ProviderError::RateLimited::retry_after.

All four trait methods are small — ~40 LOC between them. No real ergonomics are lost by going direct.

§Authentication

Personal Access Token via the Authorization: Bearer <token> header. The SecretString is kept wrapped until the per-request header is built; we never log the exposed value.

§Lint exception

This module allows unsafe_code at module level because linkme::distributed_slice’s expansion emits a #[link_section] attribute that Rust 1.95+ flags under the unsafe_code lint. No hand-rolled unsafe blocks exist in this module.

§Rate limits

GitHub returns 403 + X-RateLimit-Remaining: 0 when the caller exhausts their budget. We surface this as ProviderError::RateLimited with retry_after populated from either the Retry-After header or the X-RateLimit-Reset epoch seconds value, whichever is present.

Structs§

GithubProvider
GitHub-specific release provider. Register via the link-time registration in this module; callers construct it through factory.

Functions§

factory
Build a GithubProvider from a parsed config and an optional PAT. Enforces HTTPS at construction; any URL with an explicit http:// scheme is rejected via ProviderError::InvalidConfig.