@quenty/cli-output-helpers
Version:
Helpers to generate Nevermore package and game templates
38 lines • 1.48 kB
TypeScript
/**
* GitHub API helpers for posting and updating PR comments.
*/
/** Shared marker used for the combined CI results comment. */
export declare const SHARED_CI_COMMENT_MARKER = "<!-- nevermore-ci-results -->";
interface GitHubContext {
token: string;
owner: string;
repo: string;
prNumber: number;
}
/**
* Resolve GitHub context from environment variables.
*
* Reads GITHUB_TOKEN, GITHUB_REPOSITORY, and determines the PR number
* from GITHUB_REF_NAME (e.g. "123/merge") or the event payload at
* GITHUB_EVENT_PATH.
*/
export declare function resolveGitHubContext(): GitHubContext | undefined;
/**
* Post or update a PR comment identified by a marker string.
*
* Searches existing comments for one containing `commentMarker`.
* If found, updates it via PATCH; otherwise creates a new comment.
* Returns false and warns (rather than throwing) on failure.
*/
export declare function postOrUpdateCommentAsync(commentMarker: string, body: string): Promise<boolean>;
/**
* Post or update a section within a shared PR comment.
*
* Uses {@link SHARED_CI_COMMENT_MARKER} to find the combined comment, then
* replaces the section delimited by `<!-- section:ID -->` / `<!-- /section:ID -->`.
* If the section doesn't exist yet, appends it. If no combined comment exists,
* creates one.
*/
export declare function postOrUpdateCommentSectionAsync(sectionId: string, sectionBody: string): Promise<boolean>;
export {};
//# sourceMappingURL=github-api.d.ts.map