default

Examples

Automatic lifecycle management with withCheckRun

import { createInMemory } from "@anabranch/check-runs";
import { Task } from "@anabranch/anabranch";

const checkRuns = createInMemory();

await checkRuns
  .withCheckRun("my-check", "abc123def456", (started) =>
    Task.of(async () => {
      // Write annotations during the check
      await started.writeAnnotation({
        path: "src/index.ts",
        startLine: 42,
        level: "warning",
        message: "Unused import",
      });
    })
  )
  .run();
// Automatically completes with "success" or "failure" based on callback result

Manual lifecycle management (for advanced use cases)

const checkRuns = createInMemory();
const checkRun = await checkRuns.create("my-check", "abc123").run();
await checkRuns.start(checkRun).run();
await checkRuns.complete(checkRun, "success").run();

Classes

c
AnnotationsClosedError(checkRunId: number)

Error thrown when attempting to push annotations to a closed check run.

c
AnnotationsViaChannelError()

Error thrown when using update() with annotations instead of the channel.

c
CheckRunAlreadyCompleted(checkRunId: number)

Error thrown when attempting to modify a completed check run.

c
CheckRunAlreadyStarted(checkRunId: number)

Error thrown when attempting to start an already in-progress check run.

c
CheckRunNotFound(checkRunId: number)

Error thrown when a check run is not found.

c
CheckRunsApiError(
message: string,
details: CheckRunsErrorDetails
)

Error thrown when the GitHub API returns an error response.

c
CheckRunsError(
message: string,
details?: CheckRunsErrorDetails
)

Base error class for CheckRuns operations.

Functions

Interfaces

I
Annotation

Annotation attached to a check run for reporting issues.

I
AnnotationBatcherConfig

Configuration for annotation batching.

I
CheckRun

Represents a GitHub check run with its state and metadata.

I
CheckRunComplete

Options for completing a check run with a conclusion.

I
CheckRunsErrorDetails

Additional details included with CheckRuns errors.

I
CheckRunsOptions

Configuration options for the CheckRuns client.

I
CheckRunUpdate

Fields that can be updated on an existing check run.

I
CreateOptions

Options for creating a new check run.

I
StartedCheckRun

A started check run with annotation streaming capabilities.

I
WatchOptions

Options for watching a check run until completion.

Type Aliases