Skip to main content

Module client

Module client 

Source
Expand description

GitHub Apps API client.

Three responsibilities:

  1. Exchange a manifest-flow code for permanent app credentials.
  2. List installations of an app + map owner → installation_id.
  3. Add/remove repos within an existing installation (full IaC for ongoing install scope changes).

Structs§

AppCredentials
Permanent credentials returned by the manifest exchange.

Constants§

GITHUB_API

Functions§

exchange_manifest_code
Exchange a one-time code from the manifest redirect for permanent app credentials. The code is single-use and expires within 1 hour.
install_on_repos
Add a list of repos to an existing installation. Idempotent — GitHub returns 204 even if a repo is already in the installation.
lookup_installation_id
List all installations of the app and return the installation ID for the given owner (org or user). Returns Ok(None) if the app isn’t installed on that owner yet — caller can prompt for an install click.
rotate_private_key
Rotate the App’s private key. Creates a new key, writes the new credentials to the sink, then deletes the old key. Idempotent: if the second or third step fails, re-running the rotate command picks up where it left off (the API tracks both keys until one is explicitly deleted).