Skip to content

Built for people who want to own their automations. Join the waitlist for an invite.

Package listing

@kentcdodds/github

src/pr/merge-durable.ts

24 lines · 1.1 KB · TypeScript
import { mergePrDirect, type MergePrResult } from './merge.ts'

/**
 * Durable workflow entrypoint for finishing a slow GitHub merge.
 *
 * Invoked by `pr/merge` via `workflows.create({ exportName: './pr/merge-durable' })`
 * after a direct merge attempt aborts. Performs the same merge (idempotent:
 * already-merged PRs return `already_merged`) without escalating to another
 * workflow. Unmergeable / terminal outcomes return structured results without
 * throwing so the workflow does not retry forever; transient timeouts throw so
 * Cloudflare Workflows can retry within its bounded policy.
 *
 * @param params - Same locator/merge fields as `pr/merge`.
 * @returns Structured merge result from the direct (non-escalating) merge path.
 * @example
 * // Dispatched automatically by pr/merge — agents normally do not call this.
 * import mergeDurable from 'kody:@kentcdodds/github/pr/merge-durable'
 * const result = await mergeDurable({ owner: 'kentcdodds', repo: 'kody', prNumber: 1 })
 */
export default async function mergeDurable(
	params: Record<string, unknown> = {},
): Promise<MergePrResult> {
	return await mergePrDirect(params)
}