export interface RepoRef { owner: string; repo: string; } export interface WorkflowRunQuery extends RepoRef { /** Workflow file name, for example `ci.yaml`. */ workflow: string; branch: string; /** Trigger event of the runs, for example `push` or `schedule`. */ event: string; /** 1-based page of runs, defaults to 1. */ page?: number; } /** Labels of release PRs; `setLabel` keeps one of them per PR. */ export declare const LABELS: { readonly pending: "tallyrelease: pending"; readonly released: "tallyrelease: released"; readonly stale: "tallyrelease: stale"; }; export interface ReleasePr { number: number; /** Web URL. */ url: string; /** Head branch name. */ head: string; headSha: string; base: string; body: string; labels: string[]; /** Null unless merged. */ mergedAt: string | null; mergeCommitSha: string | null; } export interface ReleasePrQuery { /** Base branch. */ base: string; /** Open PRs by number, or merged PRs oldest merge first. */ state: "open" | "merged"; } export interface NewPr { head: string; base: string; title: string; body: string; } export interface NewRelease { tag: string; name: string; body: string; makeLatest: boolean; /** Marks the release as a prerelease. */ prerelease?: boolean; } /** Code host API used by the cli. */ export interface Forge { /** Head shas of successful runs of a workflow on a branch for one event, newest first; empty past the last page. */ lastSuccessfulRuns: (query: WorkflowRunQuery) => Promise; /** PRs labelled `tallyrelease: pending` on a base branch, from heads in this repository. */ releasePrs: (repo: RepoRef, query: ReleasePrQuery) => Promise; /** Open PR from `head` in this repository into `base`, whatever its labels. */ openPr: (repo: RepoRef, query: { head: string; base: string; }) => Promise; /** Returns the PR number; `ForgeConflictError` when the PR exists. */ createPr: (repo: RepoRef, pr: NewPr) => Promise; updatePr: (repo: RepoRef, number: number, update: { title?: string; body?: string; }) => Promise; closePr: (repo: RepoRef, number: number, comment: string) => Promise; /** Sets `label`, removes the other `tallyrelease:` labels, creates missing labels. */ setLabel: (repo: RepoRef, number: number, update: { label: string; comment?: string; }) => Promise; /** Undefined when the branch does not exist. */ branchSha: (repo: RepoRef, branch: string) => Promise; /** PR that merged `sha`, undefined if none. */ prForCommit: (repo: RepoRef, sha: string) => Promise<{ number: number; url: string; labels: string[]; } | undefined>; /** Undefined when no release exists for the tag. */ releaseByTag: (repo: RepoRef, tag: string) => Promise<{ id: number; url: string; } | undefined>; /** Release for an existing tag; `ForgeConflictError` when the tag has a release. */ createRelease: (repo: RepoRef, release: NewRelease) => Promise<{ id: number; url: string; }>; }