Skip to content

@usine/github/github-app

The App private key cannot sign. Raised once, when the App layer is built.

  • Schema.Class

new AppAuthenticationError(…args): AppAuthenticationError

Parameter Type
…args [props: object, options?: MakeOptions]

AppAuthenticationError

readonly message: string


The App credentials the orchestrator keeps and never passes to a worker.

  • Schema.Class

new AppCredentials(…args): AppCredentials

Parameter Type
…args [props: object, options?: MakeOptions]

AppCredentials

readonly appId: number & Brand<"GitHubAppId">

readonly privateKey: Redacted<string & Brand<"GitHubAppPrivateKey">>


The installation lacks required repository grants; missing entries use name:level form.

  • Schema.Class

new AppPermissionError(…args): AppPermissionError

Parameter Type
…args [props: object, options?: MakeOptions]

AppPermissionError

readonly message: string

readonly missing: readonly string[]


A registered repository covered by the discovered GitHub App installation.

  • Schema.Class

new CoveredProject(…args): CoveredProject

Parameter Type
…args [props: object, options?: MakeOptions]

CoveredProject

readonly installationId: number & Brand<"GitHubInstallationId">

readonly repository: string & Brand<"RepositoryName">

readonly repositoryId: number & Brand<"GitHubRepositoryId">


A failed GitHub request, with an HTTP status when a response was received.

  • Schema.Class

new GitHubApiError(…args): GitHubApiError

Parameter Type
…args [props: object, options?: MakeOptions]

GitHubApiError

readonly message: string

readonly operation: "create-repository-label" | "discover-installation" | "fetch-item-labels" | "fetch-issue-snapshot" | "fetch-pull-request-snapshot" | "list-installation-repositories" | "list-repository-labels" | "mint-installation-token" | "mint-worker-token" | "poll-repository-changes" | "update-item-labels"

readonly status: Option<number>


The factory’s GitHub identity and repository access. Orchestrator operations share installation-wide access; each Worker token is newly minted for the repository assigned to its Attempt.

  • Context.ServiceClass

readonly Service: object

The service’s operations: what yield* GitHubApp returns.

readonly installation: () => Effect.Effect<Installation, GitHubAppError>

Returns the App installation after checking its required permissions.

Effect.Effect<Installation, GitHubAppError>

readonly installationToken: () => Effect.Effect<InstallationToken, GitHubAppError>

Returns the shared installation-wide token for orchestrator operations, renewing it near expiry.

Effect.Effect<InstallationToken, GitHubAppError>

readonly projectAccess: (registry) => Effect.Effect<ReadonlyArray<ProjectAccess>, GitHubAppError>

Reports access for every registry repository, retaining uncovered Projects as individual errors.

Parameter Type
registry ReadonlyArray<RepositoryName>

Effect.Effect<ReadonlyArray<ProjectAccess>, GitHubAppError>

readonly workerToken: (project) => Effect.Effect<InstallationToken, GitHubAppError>

Mints a fresh token restricted to the covered Project’s repository for a Worker.

Parameter Type
project CoveredProject

Effect.Effect<InstallationToken, GitHubAppError>

readonly static layer: Layer<GitHubApp, AppAuthenticationError, HttpClient | GitHubCredentials>


Supplies AppCredentials, so where credentials come from stays separate from how the App uses them.

  • Context.ServiceClass

readonly Service: AppCredentials

The service’s operations: what yield* GitHubCredentials returns.


GitHub deferred the request until retryAt; callers can schedule a later attempt.

  • Schema.Class

new GitHubRateLimitError(…args): GitHubRateLimitError

Parameter Type
…args [props: object, options?: MakeOptions]

GitHubRateLimitError

readonly message: string

readonly operation: "create-repository-label" | "discover-installation" | "fetch-item-labels" | "fetch-issue-snapshot" | "fetch-pull-request-snapshot" | "list-installation-repositories" | "list-repository-labels" | "mint-installation-token" | "mint-worker-token" | "poll-repository-changes" | "update-item-labels"

readonly retryAt: Utc


The discovered App installation and the account that owns it.

  • Schema.Class

new Installation(…args): Installation

Parameter Type
…args [props: object, options?: MakeOptions]

Installation

readonly accountLogin: string

readonly id: number & Brand<"GitHubInstallationId">


The App has no unambiguous active installation to use for repository access.

  • Schema.Class

new InstallationDiscoveryError(…args): InstallationDiscoveryError

Parameter Type
…args [props: object, options?: MakeOptions]

InstallationDiscoveryError

readonly message: string

readonly reason: "missing" | "multiple" | "suspended"


A redacted installation credential with its expiry and permitted repository scope.

  • Schema.Class

new InstallationToken(…args): InstallationToken

Parameter Type
…args [props: object, options?: MakeOptions]

InstallationToken

readonly expiresAt: Utc

readonly scope: InstallationWide | SingleRepository

readonly value: Redacted<string>


Token access to every repository covered by the installation.

  • Schema.Class

new InstallationWide(…args): InstallationWide

Parameter Type
…args [props?: object, options?: MakeOptions]

InstallationWide


GitHub returned a response that cannot be decoded or is missing required content.

  • Schema.Class

new InvalidGitHubResponseError(…args): InvalidGitHubResponseError

Parameter Type
…args [props: object, options?: MakeOptions]

InvalidGitHubResponseError

readonly detail: string

What made the response invalid: the decode path, the missing field, or the GraphQL errors.

readonly message: string

readonly operation: "create-repository-label" | "discover-installation" | "fetch-item-labels" | "fetch-issue-snapshot" | "fetch-pull-request-snapshot" | "list-installation-repositories" | "list-repository-labels" | "mint-installation-token" | "mint-worker-token" | "poll-repository-changes" | "update-item-labels"


A registry repository the installation does not cover. Raised per project, so covered siblings still load.

  • Schema.Class

new ProjectNotInstalledError(…args): ProjectNotInstalledError

Parameter Type
…args [props: object, options?: MakeOptions]

ProjectNotInstalledError

readonly message: string

readonly repository: string & Brand<"RepositoryName">


Token access restricted to the repository assigned to one Attempt.

  • Schema.Class

new SingleRepository(…args): SingleRepository

Parameter Type
…args [props: object, options?: MakeOptions]

SingleRepository

readonly repository: string & Brand<"RepositoryName">

readonly repositoryId: number & Brand<"GitHubRepositoryId">

A repository reported by GitHub for an installation, identified by its numeric id and full name.

readonly id: number & Brand<"GitHubRepositoryId">

readonly name: string & Brand<"RepositoryName">

AppId = typeof AppId.Type

The numeric GitHub App identity included in signed App JWTs.


GitHubAppError = typeof GitHubAppError.Type

Failures from discovering installation access or making an authenticated GitHub request.


GitHubOperation = typeof GitHubOperation.Type

The GitHub request that failed, shared by API, rate-limit, and response errors.


InstallationDiscoveryReason = typeof InstallationDiscoveryReason.Type

Why App installation discovery could not select one usable installation.


InstallationId = typeof InstallationId.Type

The numeric identity of an installation of the factory’s GitHub App.


PrivateKey = typeof PrivateKey.Type

A PEM-encoded RSA private key used to authenticate the GitHub App.


ProjectAccess = typeof ProjectAccess.Type

The installation coverage result for one registered repository.


RepositoryId = typeof RepositoryId.Type

GitHub’s numeric repository identity, used to restrict installation tokens.


RequiredRepositoryPermission = keyof typeof REQUIRED_REPOSITORY_PERMISSIONS


TokenScope = typeof TokenScope.Type

The repository coverage requested when minting an installation token.

const AppId: Schema.brand<Schema.Int, "GitHubAppId">

The numeric GitHub App identity included in signed App JWTs.


const deriveProjectAccess: (installation, registry, installed) => ReadonlyArray<ProjectAccess>

Checks each registry repository against the installation’s repositories and returns one ProjectAccess per project.

Parameter Type
installation Installation
registry ReadonlyArray<RepositoryName>
installed ReadonlyArray<InstalledRepository>

ReadonlyArray<ProjectAccess>


const GitHubAppError: Schema.Union<readonly [typeof InstallationDiscoveryError, typeof AppPermissionError, typeof GitHubApiError, typeof GitHubRateLimitError, typeof InvalidGitHubResponseError]>

Failures from discovering installation access or making an authenticated GitHub request.


const GitHubOperation: Schema.Literals<readonly ["create-repository-label", "discover-installation", "fetch-item-labels", "fetch-issue-snapshot", "fetch-pull-request-snapshot", "list-installation-repositories", "list-repository-labels", "mint-installation-token", "mint-worker-token", "poll-repository-changes", "update-item-labels"]>

The GitHub request that failed, shared by API, rate-limit, and response errors.


const InstallationDiscoveryReason: Schema.Literals<readonly ["missing", "multiple", "suspended"]>

Why App installation discovery could not select one usable installation.


const InstallationId: Schema.brand<Schema.Int, "GitHubInstallationId">

The numeric identity of an installation of the factory’s GitHub App.


const missingPermissions: (granted) => ReadonlyArray<string>

The required repository permissions an installation grant does not satisfy, as name:level strings.

Parameter Type
granted Readonly<Record<string, string>>

ReadonlyArray<string>


const PrivateKey: Schema.brand<Schema.NonEmptyString, "GitHubAppPrivateKey">

A PEM-encoded RSA private key used to authenticate the GitHub App.


const ProjectAccess: Schema.Union<readonly [typeof CoveredProject, typeof ProjectNotInstalledError]>

The installation coverage result for one registered repository.


const RedactedPrivateKey: Schema.RedactedFromValue<Schema.brand<Schema.NonEmptyString, "GitHubAppPrivateKey">>

An App signing key that stays redacted in diagnostics and cannot be encoded.


const RepositoryId: Schema.brand<Schema.Int, "GitHubRepositoryId">

GitHub’s numeric repository identity, used to restrict installation tokens.


const REQUIRED_REPOSITORY_PERMISSIONS: object

Repository grants required for polling, label updates, and agent-authored changes.

readonly checks: "read"

readonly contents: "write"

readonly issues: "write"

readonly metadata: "read"

readonly pull_requests: "write"


const TokenScope: Schema.Union<readonly [typeof InstallationWide, typeof SingleRepository]>

The repository coverage requested when minting an installation token.