From e80931f0826124db0a241ba9876c8e8eb3ca4d75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaroslav=20Loba=C4=8Devski?= Date: Mon, 8 Jul 2024 22:50:09 +0200 Subject: [PATCH] Fix the artifact regex (#30) --- advisor/dist/index.js | 12 ++++++++++-- advisor/index.js | 12 ++++++++++-- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/advisor/dist/index.js b/advisor/dist/index.js index af341ff..c1beae6 100644 --- a/advisor/dist/index.js +++ b/advisor/dist/index.js @@ -34023,14 +34023,22 @@ async function analyze(name, count, token, owner, repo, branch) { continue; } - const logUploadMatch = log.data.match(/^.* Container for artifact \"(.*-permissions-[a-z0-9]+)\" successfully created\. Starting upload of file\(s\)$/m); - if (!logUploadMatch) + const logUploadMatch = log.data.match(/([^ "]+-permissions-[a-z0-9]{32})/m); + if (!logUploadMatch) { + if (process.env.RUNNER_DEBUG) { + console.log(`Cannot find the magic string. Skipping.`); + } continue; + } const artifactName = logUploadMatch[1]; + if (process.env.RUNNER_DEBUG) + console.log(`Looking for artifactName ${artifactName}`); const jobName = artifactName.split('-').slice(0, -2).join('-'); for (const artifact of artifacts.data.artifacts) { if (artifact.name === artifactName) { + if (process.env.RUNNER_DEBUG) + console.log(`Downloading artifact id ${artifact.id}`); const download = await octokit.rest.actions.downloadArtifact({ owner: owner, repo: repo, diff --git a/advisor/index.js b/advisor/index.js index 0e72350..c3aa2e3 100644 --- a/advisor/index.js +++ b/advisor/index.js @@ -62,14 +62,22 @@ async function analyze(name, count, token, owner, repo, branch) { continue; } - const logUploadMatch = log.data.match(/^.* Container for artifact \"(.*-permissions-[a-z0-9]+)\" successfully created\. Starting upload of file\(s\)$/m); - if (!logUploadMatch) + const logUploadMatch = log.data.match(/([^ "]+-permissions-[a-z0-9]{32})/m); + if (!logUploadMatch) { + if (process.env.RUNNER_DEBUG) { + console.log(`Cannot find the magic string. Skipping.`); + } continue; + } const artifactName = logUploadMatch[1]; + if (process.env.RUNNER_DEBUG) + console.log(`Looking for artifactName ${artifactName}`); const jobName = artifactName.split('-').slice(0, -2).join('-'); for (const artifact of artifacts.data.artifacts) { if (artifact.name === artifactName) { + if (process.env.RUNNER_DEBUG) + console.log(`Downloading artifact id ${artifact.id}`); const download = await octokit.rest.actions.downloadArtifact({ owner: owner, repo: repo,