From 7ff6d60aa14834cebb867e67fc74c7c10bd8078f Mon Sep 17 00:00:00 2001 From: Courtney Sims Date: Tue, 22 Oct 2024 15:06:42 -0500 Subject: [PATCH] test --- src/wranglerArtifactManager.ts | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/wranglerArtifactManager.ts b/src/wranglerArtifactManager.ts index 0ec34559..7c1019fc 100644 --- a/src/wranglerArtifactManager.ts +++ b/src/wranglerArtifactManager.ts @@ -57,23 +57,26 @@ export async function getDetailedPagesDeployOutput( const artifactFilePaths = await getWranglerArtifacts(artifactDirectory); for (let i = 0; i < artifactFilePaths.length; i++) { - const file = await open(artifactFilePaths[i]); - for await (const line of file.readLines()) { try { - const output = JSON.parse(line); - const parsedOutput = OutputEntryPagesDeployment.parse(output); - if (parsedOutput.type === "pages-deploy-detailed") { - // Assume, in the context of the action, the first detailed deploy instance seen will suffice - return parsedOutput; + const file = await open(artifactFilePaths[i], 'r'); + + for await (const line of file.readLines()) { + + const output = JSON.parse(line); + const parsedOutput = OutputEntryPagesDeployment.parse(output); + if (parsedOutput.type === "pages-deploy-detailed") { + // Assume, in the context of the action, the first detailed deploy instance seen will suffice + return parsedOutput; + } } + + await file.close(); } catch (err) { - // If the line can't be parsed, skip it + // Many versions of wrangler may not have output files or pages-deploy-detailed output + // If we can't interact with an output file, just move on continue; } - } - - await file.close(); } return null;