Tweak comment footer (#208)

* Tweak comment footer

* take 2

* tweak

* tweak

* add dev path

* defensively guard against missing job in the array
This commit is contained in:
Mateusz Burzyński
2026-02-03 18:49:48 +00:00
committed by pullfrog[bot]
parent bfe72ac2cf
commit adc165d95f
3 changed files with 34 additions and 37 deletions
+14 -17
View File
@@ -136836,19 +136836,21 @@ var PULLFROG_DIVIDER = "<!-- PULLFROG_DIVIDER_DO_NOT_REMOVE_PLZ -->";
var FROG_LOGO = `<a href="https://pullfrog.com"><picture><source media="(prefers-color-scheme: dark)" srcset="https://pullfrog.com/logos/frog-white-full-18px.png"><img src="https://pullfrog.com/logos/frog-green-full-18px.png" width="9px" height="9px" style="vertical-align: middle; " alt="Pullfrog"></picture></a>`;
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 });