diff --git a/dist/index.js b/dist/index.js index 612ace3..b87724b 100644 --- a/dist/index.js +++ b/dist/index.js @@ -127878,7 +127878,7 @@ function getSign(bytes) { ;// CONCATENATED MODULE: ./src/text-format.ts function formatTextFragments(...text) { return text - .map((fragment) => fragment.trim()) + .map((fragment) => fragment === null || fragment === void 0 ? void 0 : fragment.trim()) .filter(Boolean) .join('\n\n'); } @@ -127897,7 +127897,7 @@ async function createOrReplaceComment({ octokit, issueNumber, title, shaInfo, ro issueNumber, text: title, }); - const body = formatTextFragments(title, shaInfo, routesTable !== null && routesTable !== void 0 ? routesTable : FALLBACK_COMPARISON_TEXT, dynamicTable !== null && dynamicTable !== void 0 ? dynamicTable : FALLBACK_COMPARISON_TEXT); + const body = formatTextFragments(title, shaInfo, routesTable, dynamicTable, !(routesTable === null || routesTable === void 0 ? void 0 : routesTable.trim()) && !(dynamicTable === null || dynamicTable === void 0 ? void 0 : dynamicTable.trim()) ? FALLBACK_COMPARISON_TEXT : null); if (existingComment) { console.log(`Updating comment ${existingComment.id}`); const response = await octokit.rest.issues.updateComment(Object.assign(Object.assign({}, github.context.repo), { comment_id: existingComment.id, body })); diff --git a/src/comments.ts b/src/comments.ts index 8eda1b6..d00e22a 100644 --- a/src/comments.ts +++ b/src/comments.ts @@ -48,8 +48,9 @@ export async function createOrReplaceComment({ const body = formatTextFragments( title, shaInfo, - routesTable ?? FALLBACK_COMPARISON_TEXT, - dynamicTable ?? FALLBACK_COMPARISON_TEXT, + routesTable, + dynamicTable, + !routesTable?.trim() && !dynamicTable?.trim() ? FALLBACK_COMPARISON_TEXT : null, ); if (existingComment) { diff --git a/src/text-format.ts b/src/text-format.ts index abb4b53..7496b82 100644 --- a/src/text-format.ts +++ b/src/text-format.ts @@ -1,6 +1,6 @@ -export function formatTextFragments(...text: string[]) { +export function formatTextFragments(...text: Array) { return text - .map((fragment) => fragment.trim()) + .map((fragment) => fragment?.trim()) .filter(Boolean) .join('\n\n'); }