From 61157cab913d5131faf31a3ebe21d72982dc4a93 Mon Sep 17 00:00:00 2001 From: Jason Finch Date: Mon, 24 Feb 2025 20:23:34 +1000 Subject: [PATCH] fix (fetch): Fix overflow when execSync buffer is exceeded --- fetchIssues.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/fetchIssues.js b/fetchIssues.js index 5ffabc8..89c3d6f 100644 --- a/fetchIssues.js +++ b/fetchIssues.js @@ -1,12 +1,14 @@ import { execSync } from "child_process"; import fs from "fs"; -export const fetchIssues = (repo, issuesFilePath) => { +export const fetchIssues = ( repo, issuesFilePath, bufferSizeInMb = 10, issueLimit = 1000) => { try { console.log(`Fetching issues from ${repo}...`); const issues = execSync( - `gh issue list --repo ${repo} --limit 1000 --state all --json title,body,labels`, - { encoding: "utf8" } + `gh issue list --repo ${repo} --limit ${issueLimit} --state all --json title,body,labels`, + { encoding: "utf8", + maxBuffer: 1024 * 1024 * bufferSizeInMb + } ); fs.writeFileSync(issuesFilePath, issues); console.info(`✅ Issues saved to ${issuesFilePath}.`);