Skip to content

Commit

Permalink
Fix the artifact regex (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
JarLob authored Jul 8, 2024
1 parent 5e521fb commit e80931f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
12 changes: 10 additions & 2 deletions advisor/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
12 changes: 10 additions & 2 deletions advisor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit e80931f

Please sign in to comment.