/** * @file Create a SIGNED commit on a branch via the GitHub git-objects API * (blob -> tree -> commit -> ref PATCH). Commits created through the API are * web-flow-verified ("Verified" / signed) without a local GPG or SSH signing * key — the only way CI can land a commit on a branch whose protection * requires signed commits. Built on `github/request` (`fetchGitHub`) and the * `github/token` resolver for auth/retry/error consistency. */ /** * A single file to include in the signed commit. */ export interface CommitFile { /** * UTF-8 text contents to write at `path`. */ readonly content: string; /** * Repo-relative path, POSIX separators (e.g. 'package.json'). */ readonly path: string; } /** * Options for `createSignedCommit`. */ export interface CreateSignedCommitOptions { /** * Override the API origin (GitHub Enterprise or tests). Defaults to * https://api.github.com. */ readonly apiUrl?: string | undefined; /** * SHA of the tree to layer the new files onto (usually `HEAD^{tree}`). */ readonly baseTreeSha: string; /** * Branch to advance (e.g. 'main'). */ readonly branch: string; /** * Files to write in the commit. */ readonly files: readonly CommitFile[]; /** * Commit message. */ readonly message: string; /** * Parent commit SHA (usually `HEAD`). */ readonly parentSha: string; /** * Repo in "owner/name" form. */ readonly repo: string; /** * GitHub token. Falls back to env / `git config` via `getGitHubToken()`. */ readonly token?: string | undefined; } export declare function buildHeaders(token: string): Record; /** * Create a signed commit on a branch via the GitHub git-objects API (blob -> * tree -> commit -> ref PATCH). Returns the new commit SHA. Commits created * through the API are web-flow-verified ("Verified") without a local signing * key — the only way CI can land signed commits on protected branches. * * @example * ;```ts * const sha = await createSignedCommit({ * repo: 'owner/repo', * branch: 'main', * parentSha: 'abc123', * baseTreeSha: 'def456', * message: 'chore: bump version to 1.2.0', * files: [ * { path: 'package.json', content: '{"version":"1.2.0"}' }, * { path: 'CHANGELOG.md', content: '# Changelog\n' }, * ], * token: process.env['GITHUB_TOKEN'], * }) * ``` * * @param options - Commit options including repo, branch, parent SHA, base tree * SHA, files, message, and optional token/API URL override. * * @returns The new (verified) commit SHA. * * @throws {Error} When any GitHub git-objects API call fails. */ export declare function createSignedCommit(options: CreateSignedCommitOptions): Promise; export declare function patch(url: string, headers: Record, body: unknown): Promise; export declare function post(url: string, headers: Record, body: unknown): Promise;