Cut down unnecessary logs
This commit is contained in:
committed by
pullfrog[bot]
parent
5d4f81a007
commit
b860c8a665
@@ -157786,25 +157786,13 @@ function hasImages(body) {
|
|||||||
}
|
}
|
||||||
async function resolveBody(ctx) {
|
async function resolveBody(ctx) {
|
||||||
const body = ctx.event.body;
|
const body = ctx.event.body;
|
||||||
log.info(`[resolveBody] trigger: ${ctx.event.trigger}`);
|
if (!hasImages(body)) return body ?? null;
|
||||||
log.info(`[resolveBody] original body (first 200 chars): ${body?.substring(0, 200)}`);
|
log.debug(`[resolveBody] fetching body_html for ${ctx.event.trigger}`);
|
||||||
log.info(`[resolveBody] hasImages: ${hasImages(body)}`);
|
|
||||||
if (!hasImages(body)) {
|
|
||||||
log.info("[resolveBody] no images detected, returning original body");
|
|
||||||
return body ?? null;
|
|
||||||
}
|
|
||||||
log.info("[resolveBody] images detected, fetching body_html from GitHub API...");
|
|
||||||
const bodyHtml = await fetchBodyHtml(ctx);
|
const bodyHtml = await fetchBodyHtml(ctx);
|
||||||
log.info(`[resolveBody] bodyHtml received: ${bodyHtml ? "yes" : "no"}`);
|
log.debug(`[resolveBody] bodyHtml: ${bodyHtml?.substring(0, 300)}`);
|
||||||
if (bodyHtml) {
|
if (!bodyHtml) return body ?? null;
|
||||||
log.info(`[resolveBody] bodyHtml (first 500 chars): ${bodyHtml.substring(0, 500)}`);
|
|
||||||
}
|
|
||||||
if (!bodyHtml) {
|
|
||||||
log.info("[resolveBody] no bodyHtml returned, returning original body");
|
|
||||||
return body ?? null;
|
|
||||||
}
|
|
||||||
const resolved = turndown.turndown(bodyHtml);
|
const resolved = turndown.turndown(bodyHtml);
|
||||||
log.info(`[resolveBody] resolved markdown (first 500 chars): ${resolved.substring(0, 500)}`);
|
log.debug(`[resolveBody] resolved: ${resolved.substring(0, 300)}`);
|
||||||
return resolved;
|
return resolved;
|
||||||
}
|
}
|
||||||
async function fetchBodyHtml(ctx) {
|
async function fetchBodyHtml(ctx) {
|
||||||
|
|||||||
+6
-19
@@ -1,8 +1,8 @@
|
|||||||
import TurndownService from "turndown";
|
import TurndownService from "turndown";
|
||||||
import type { PayloadEvent } from "../external.ts";
|
import type { PayloadEvent } from "../external.ts";
|
||||||
|
import { log } from "./cli.ts";
|
||||||
import type { OctokitWithPlugins } from "./github.ts";
|
import type { OctokitWithPlugins } from "./github.ts";
|
||||||
import type { RepoData } from "./repoData.ts";
|
import type { RepoData } from "./repoData.ts";
|
||||||
import { log } from "./cli.ts";
|
|
||||||
|
|
||||||
const turndown = new TurndownService();
|
const turndown = new TurndownService();
|
||||||
|
|
||||||
@@ -26,29 +26,16 @@ interface ResolveBodyContext {
|
|||||||
export async function resolveBody(ctx: ResolveBodyContext): Promise<string | null> {
|
export async function resolveBody(ctx: ResolveBodyContext): Promise<string | null> {
|
||||||
const body = ctx.event.body;
|
const body = ctx.event.body;
|
||||||
|
|
||||||
log.info(`[resolveBody] trigger: ${ctx.event.trigger}`);
|
|
||||||
log.info(`[resolveBody] original body (first 200 chars): ${body?.substring(0, 200)}`);
|
|
||||||
log.info(`[resolveBody] hasImages: ${hasImages(body)}`);
|
|
||||||
|
|
||||||
// pass through if no images - no API call needed
|
// pass through if no images - no API call needed
|
||||||
if (!hasImages(body)) {
|
if (!hasImages(body)) return body ?? null;
|
||||||
log.info("[resolveBody] no images detected, returning original body");
|
|
||||||
return body ?? null;
|
|
||||||
}
|
|
||||||
|
|
||||||
log.info("[resolveBody] images detected, fetching body_html from GitHub API...");
|
log.debug(`[resolveBody] fetching body_html for ${ctx.event.trigger}`);
|
||||||
const bodyHtml = await fetchBodyHtml(ctx);
|
const bodyHtml = await fetchBodyHtml(ctx);
|
||||||
log.info(`[resolveBody] bodyHtml received: ${bodyHtml ? "yes" : "no"}`);
|
log.debug(`[resolveBody] bodyHtml: ${bodyHtml?.substring(0, 300)}`);
|
||||||
if (bodyHtml) {
|
if (!bodyHtml) return body ?? null;
|
||||||
log.info(`[resolveBody] bodyHtml (first 500 chars): ${bodyHtml.substring(0, 500)}`);
|
|
||||||
}
|
|
||||||
if (!bodyHtml) {
|
|
||||||
log.info("[resolveBody] no bodyHtml returned, returning original body");
|
|
||||||
return body ?? null;
|
|
||||||
}
|
|
||||||
|
|
||||||
const resolved = turndown.turndown(bodyHtml);
|
const resolved = turndown.turndown(bodyHtml);
|
||||||
log.info(`[resolveBody] resolved markdown (first 500 chars): ${resolved.substring(0, 500)}`);
|
log.debug(`[resolveBody] resolved: ${resolved.substring(0, 300)}`);
|
||||||
return resolved;
|
return resolved;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user