From 9545cc37e5704d69bd86f3e4d0efd32472fc6561 Mon Sep 17 00:00:00 2001 From: Shivaditya Shivganesh Date: Mon, 13 Jan 2025 02:21:53 -0500 Subject: [PATCH] fix: invalid filter function --- functions/issue-scraper.ts | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/functions/issue-scraper.ts b/functions/issue-scraper.ts index 9c8a09f..b494773 100644 --- a/functions/issue-scraper.ts +++ b/functions/issue-scraper.ts @@ -276,7 +276,7 @@ async function issueScraper(username: string, supabase: SupabaseClient, voyageAp const authorIdMap = await batchFetchAuthorIds(octokit, uniqueAuthors); - // Filter the issues to include only those with an valid title + // Filter the issues to include only those with a valid title issues = issues.filter((issue) => { if (!issue.title) { storageFailed.push({ @@ -285,8 +285,22 @@ async function issueScraper(username: string, supabase: SupabaseClient, voyageAp }); return false; } + return true; }); + if (issues.length === 0) { + return JSON.stringify({ + success: false, + stats: { + storageSuccessful: 0, + storageFailed: storageFailed.length, + }, + issues: [], + storageFailed: storageFailed, + error: "No valid issues found to process" + }, null, 2); + } + const markdowns = issues.map((issue) => { return `${issue.body || ""} ${issue.title}`; });