Automatic lifecycle management with withCheckRun
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