devops.release.github

Minimal GitHub REST client for the release tooling.

Classes

GitHubClient([api_url, token, timeout])

Send JSON requests to the GitHub REST API.

class devops.release.github.GitHubClient(api_url=None, token=None, timeout=30)[source]

Bases: object

Send JSON requests to the GitHub REST API.

The API URL comes from GITHUB_API_URL and the token from GH_TOKEN or GITHUB_TOKEN, as set by GitHub Actions.

Parameters:
  • api_url (str | None)

  • token (str | None)

  • timeout (float)

request(path, *, query=None, data=None, allow_missing=False)[source]

Send a GET request, or a POST request if data is given.

Parameters:
  • path (str) – The API path, for example /repos/owner/name/releases.

  • query (dict[str, Any] | None) – Query parameters.

  • data (dict[str, Any] | None) – The JSON body of a POST request.

  • allow_missing (bool) – Return None instead of raising when GitHub answers 404.

Returns:

Any – The decoded JSON response, or None for an allowed 404.

Raises:

ReleaseError – If the request fails or the response is not valid JSON.

Return type:

Any