export const PULLFROG_DIVIDER = ""; const FROG_LOGO = `Pullfrog`; export interface AgentInfo { displayName: string; url: string; } export interface WorkflowRunInfo { owner: string; repo: string; runId: string; } export interface BuildPullfrogFooterParams { /** add "Triggered by Pullfrog" link */ triggeredBy?: boolean; /** add "Using [agent](url)" link */ agent?: AgentInfo | undefined; /** add "View workflow run" link */ workflowRun?: WorkflowRunInfo | undefined; /** arbitrary custom parts (e.g., action links) */ customParts?: string[]; } /** * build a pullfrog footer with configurable parts * always includes: frog logo at start, pullfrog.com link and X link at end */ export function buildPullfrogFooter(params: BuildPullfrogFooterParams): string { const parts: string[] = []; if (params.triggeredBy) { parts.push("Triggered by [Pullfrog](https://pullfrog.com)"); } if (params.agent) { parts.push(`Using [${params.agent.displayName}](${params.agent.url})`); } if (params.workflowRun) { parts.push( `[View workflow run](https://github.com/${params.workflowRun.owner}/${params.workflowRun.repo}/actions/runs/${params.workflowRun.runId})` ); } if (params.customParts) { parts.push(...params.customParts); } const allParts = [ ...parts, "[pullfrog.com](https://pullfrog.com)", "[𝕏](https://x.com/pullfrogai)", ]; return ` ${PULLFROG_DIVIDER} ${FROG_LOGO}  | ${allParts.join(" | ")}`; } /** * strip any existing pullfrog footer from a comment body */ export function stripExistingFooter(body: string): string { const dividerIndex = body.indexOf(PULLFROG_DIVIDER); if (dividerIndex === -1) { return body; } return body.substring(0, dividerIndex).trimEnd(); }