diff --git a/entry b/entry index 98fe2f9..a7b9497 100755 --- a/entry +++ b/entry @@ -136836,19 +136836,21 @@ var PULLFROG_DIVIDER = ""; var FROG_LOGO = `Pullfrog`; function buildPullfrogFooter(params) { const parts = []; - if (params.triggeredBy) { - parts.push("Triggered by [Pullfrog](https://pullfrog.com)"); + if (params.customParts) { + parts.push(...params.customParts); + } + if (params.workflowRunUrl) { + parts.push(`[View workflow run](${params.workflowRunUrl})`); + } else if (params.workflowRun) { + const baseUrl = `https://github.com/${params.workflowRun.owner}/${params.workflowRun.repo}/actions/runs/${params.workflowRun.runId}`; + const url4 = params.workflowRun.jobId ? `${baseUrl}/job/${params.workflowRun.jobId}` : baseUrl; + parts.push(`[View workflow run](${url4})`); } if (params.agent) { parts.push(`Using [${params.agent.displayName}](${params.agent.url})`); } - if (params.customParts) { - parts.push(...params.customParts); - } - if (params.workflowRun) { - const baseUrl = `https://github.com/${params.workflowRun.owner}/${params.workflowRun.repo}/actions/runs/${params.workflowRun.runId}`; - const url4 = params.workflowRun.jobId ? `${baseUrl}/job/${params.workflowRun.jobId}` : baseUrl; - parts.push(`[View workflow run](${url4})`); + if (params.triggeredBy) { + parts.push("Triggered by [Pullfrog](https://pullfrog.com)"); } const allParts = [ ...parts, @@ -140721,7 +140723,7 @@ async function buildCommentFooter({ }) { const repoContext = parseRepoContext(); const runId = process.env.GITHUB_RUN_ID; - let workflowRunHtmlUrl; + let jobId; if (runId && octokit) { try { const { data: jobs } = await octokit.rest.actions.listJobsForWorkflowRun({ @@ -140729,7 +140731,7 @@ async function buildCommentFooter({ repo: repoContext.name, run_id: parseInt(runId, 10) }); - workflowRunHtmlUrl = jobs.jobs[0]?.html_url ?? void 0; + jobId = jobs.jobs[0]?.id.toString(); } catch { } } @@ -140739,12 +140741,7 @@ async function buildCommentFooter({ displayName: agent2?.displayName || "Unknown agent", url: agent2?.url || "https://pullfrog.com" }, - workflowRun: runId ? { - owner: repoContext.owner, - repo: repoContext.name, - runId, - ...workflowRunHtmlUrl ? { htmlUrl: workflowRunHtmlUrl } : {} - } : void 0 + workflowRun: runId ? { owner: repoContext.owner, repo: repoContext.name, runId, jobId } : void 0 }; if (customParts && customParts.length > 0) { return buildPullfrogFooter({ ...footerParams, customParts }); diff --git a/mcp/comment.ts b/mcp/comment.ts index f3e03ee..25bd4c2 100644 --- a/mcp/comment.ts +++ b/mcp/comment.ts @@ -26,7 +26,7 @@ async function buildCommentFooter({ const repoContext = parseRepoContext(); const runId = process.env.GITHUB_RUN_ID; - let workflowRunHtmlUrl: string | undefined; + let jobId: string | undefined; if (runId && octokit) { try { // fetch jobs to get the job URL for deep linking @@ -35,10 +35,10 @@ async function buildCommentFooter({ repo: repoContext.name, run_id: parseInt(runId, 10), }); - // use the first job's URL if available - workflowRunHtmlUrl = jobs.jobs[0]?.html_url ?? undefined; + // use the first job's ID available + jobId = jobs.jobs[0]?.id.toString(); } catch { - // fall back to building URL from runId if jobs can't be fetched + // fall back to computed URL from runId alone } } @@ -49,12 +49,7 @@ async function buildCommentFooter({ url: agent?.url || "https://pullfrog.com", }, workflowRun: runId - ? { - owner: repoContext.owner, - repo: repoContext.name, - runId, - ...(workflowRunHtmlUrl ? { htmlUrl: workflowRunHtmlUrl } : {}), - } + ? { owner: repoContext.owner, repo: repoContext.name, runId, jobId } : undefined, }; diff --git a/utils/buildPullfrogFooter.ts b/utils/buildPullfrogFooter.ts index c3e5fe9..abaf82e 100644 --- a/utils/buildPullfrogFooter.ts +++ b/utils/buildPullfrogFooter.ts @@ -22,6 +22,8 @@ export interface BuildPullfrogFooterParams { agent?: AgentInfo | undefined; /** add "View workflow run" link */ workflowRun?: WorkflowRunFooterInfo | undefined; + /** alternative: just pass a pre-built URL directly (for shortlinks etc.) */ + workflowRunUrl?: string | undefined; /** arbitrary custom parts (e.g., action links) */ customParts?: string[]; } @@ -29,26 +31,29 @@ export interface BuildPullfrogFooterParams { /** * build a pullfrog footer with configurable parts * always includes: frog logo at start, pullfrog.com link and X link at end + * order: action links (customParts) > workflow run > agent > attribution > reference links */ export function buildPullfrogFooter(params: BuildPullfrogFooterParams): string { const parts: string[] = []; - if (params.triggeredBy) { - parts.push("Triggered by [Pullfrog](https://pullfrog.com)"); + if (params.customParts) { + parts.push(...params.customParts); + } + + if (params.workflowRunUrl) { + parts.push(`[View workflow run](${params.workflowRunUrl})`); + } else if (params.workflowRun) { + const baseUrl = `https://github.com/${params.workflowRun.owner}/${params.workflowRun.repo}/actions/runs/${params.workflowRun.runId}`; + const url = params.workflowRun.jobId ? `${baseUrl}/job/${params.workflowRun.jobId}` : baseUrl; + parts.push(`[View workflow run](${url})`); } if (params.agent) { parts.push(`Using [${params.agent.displayName}](${params.agent.url})`); } - if (params.customParts) { - parts.push(...params.customParts); - } - - if (params.workflowRun) { - const baseUrl = `https://github.com/${params.workflowRun.owner}/${params.workflowRun.repo}/actions/runs/${params.workflowRun.runId}`; - const url = params.workflowRun.jobId ? `${baseUrl}/job/${params.workflowRun.jobId}` : baseUrl; - parts.push(`[View workflow run](${url})`); + if (params.triggeredBy) { + parts.push("Triggered by [Pullfrog](https://pullfrog.com)"); } const allParts = [