diff --git a/scripts/detect_duplicates.ts b/scripts/detect_duplicates.ts index 798d864afe6..65898d98646 100644 --- a/scripts/detect_duplicates.ts +++ b/scripts/detect_duplicates.ts @@ -122,7 +122,7 @@ export async function fetchExistingIssues( } // Fallback: Check for bug or feature labels - const labelNames = issue.labels.map((l: any) => + const labelNames = (issue.labels || []).map((l: any) => typeof l === "string" ? l.toLowerCase() : (l.name || "").toLowerCase() ); return labelNames.includes("bug") || labelNames.includes("feature"); @@ -143,7 +143,7 @@ export async function fetchExistingIssues( body: issue.body || "", created_at: new Date(issue.created_at), updated_at: new Date(issue.updated_at), - labels: issue.labels.map((l: any) => + labels: (issue.labels || []).map((l: any) => typeof l === "string" ? l : l.name || "" ), url: issue.html_url, diff --git a/scripts/test/test-duplicate-preview.ts b/scripts/test/test-duplicate-preview.ts index 79c1269d13f..5fc9803737d 100644 --- a/scripts/test/test-duplicate-preview.ts +++ b/scripts/test/test-duplicate-preview.ts @@ -50,7 +50,7 @@ async function previewDuplicateDetection() { console.log("─".repeat(60)); console.log(`Title: ${issue.title}`); console.log(`State: ${issue.state}`); - console.log(`Labels: ${issue.labels.map((l: any) => l.name).join(", ") || "none"}`); + console.log(`Labels: ${(issue.labels || []).map((l: any) => l.name).join(", ") || "none"}`); console.log(`Type: ${issue.type || "NOT SET"}`); console.log(`Created: ${issue.created_at}`); console.log(`URL: ${issue.html_url}`); diff --git a/scripts/test/test-github-api-response.ts b/scripts/test/test-github-api-response.ts index ec9060f4671..fd7d3c7266f 100644 --- a/scripts/test/test-github-api-response.ts +++ b/scripts/test/test-github-api-response.ts @@ -49,7 +49,7 @@ async function testGitHubAPIResponse() { console.log(` - number: ${firstIssue.number}`); console.log(` - title: ${firstIssue.title}`); console.log(` - state: ${firstIssue.state}`); - console.log(` - labels: ${firstIssue.labels.map((l: any) => l.name).join(", ")}`); + console.log(` - labels: ${(firstIssue.labels || []).map((l: any) => l.name).join(", ")}`); console.log(` - type: ${firstIssue.type || "NOT AVAILABLE"}`); console.log(` - pull_request: ${firstIssue.pull_request ? "YES" : "NO"}`); console.log(""); diff --git a/scripts/test/test-real-issue.ts b/scripts/test/test-real-issue.ts index 47b1d7fbc13..994117d566f 100644 --- a/scripts/test/test-real-issue.ts +++ b/scripts/test/test-real-issue.ts @@ -50,7 +50,7 @@ async function testRealIssue() { console.log("─".repeat(60)); console.log(`Title: ${issue.title}`); console.log(`State: ${issue.state}`); - console.log(`Labels: ${issue.labels.map((l: any) => l.name).join(", ") || "none"}`); + console.log(`Labels: ${(issue.labels || []).map((l: any) => l.name).join(", ") || "none"}`); console.log(`Created: ${issue.created_at}`); console.log(`URL: ${issue.html_url}`); console.log("─".repeat(60));