← Back to all sparks
G

gh

INFRA · APIS
Velocity2.5

Minimalistic GitHub API client in R. Contribute to r-lib/gh development by creating an account on GitHub.

gh spent its last two releases making failures and interruptions recoverable.

github-apihttp-clientpaginationtoken-handlingtesting
Current state
The GitHub API client rebuilt on httr2 in 1.4.0, then took a security-driven breaking change in 1.5.0: response headers are no longer stored in returned objects, because they can carry sensitive information. The 1.6.0 release made interrupted pagination recoverable and downgraded personal access token format validation from an error to a warning.
Where it's heading
The direction is tolerance for partial and unusual outcomes rather than new endpoint coverage. Interrupting a paginated call now raises a classed condition carrying the records already fetched; a 304 Not Modified returns an empty response with headers intact instead of erroring; an unrecognised token format warns and proceeds. A fake_github_app() built on webfakes ships for testing, and is offered to other package authors.
Prediction
Token format handling is now configurable rather than fixed, so the next likely work is following GitHub's credential formats as they change, not expanding the client surface.

Recent moves

  1. 25d ago

    Pagination progress bar reports true record counts

    The pagination progress bar now reports the real record count an endpoint holds even when .limit is set to a large finite value. A display fix on the pagination work from 1.6.0.

    View source ↗
  2. 2mo ago

    Interrupted pagination keeps its partial results

    Interrupting a paginated call now raises a classed gh_interrupt carrying the records fetched so far, token format validation warns instead of erroring, 304 Not Modified responses are handled properly, and a fake_github_app() webfakes server ships for testing. All of it makes partial and unusual outcomes recoverable.

    View source ↗
  3. 1y ago

    Response headers dropped from results after a security advisory

    ⚡ SPARK

    A security advisory drives a breaking change: response headers are no longer retained in returned objects, so gh_next() and friends need the token and headers passed again. The same release adds an httr2-backed on-disk cache and Posit Connect credential pickup.

    View source ↗
  4. 2y ago

    Pagination helpers repaired and atomic file writes

    Repairs the gh_next(), gh_prev(), gh_first() and gh_last() helpers, and makes .destfile writes go to a temporary file renamed on success or deleted on error.

    View source ↗
  5. 3y ago

    Client rebuilt on httr2 with rate-limit controls

    The engine swap: gh moves onto httr2, gaining .max_rate and .max_wait controls, a gh_rate_limits() report and fine-grained token validation. It sets up the caching and header behaviour that 1.5.0 and 1.6.0 then adjust.

    View source ↗
  6. 3y ago

    Lower-case methods and richer error conditions

    Accepts lower-case HTTP methods and returns response headers and content in error conditions so handlers can read rate-limit resets. A small ergonomics release.

    View source ↗