Skip to content

Commit e80931f

Browse files
authored
Fix the artifact regex (#30)
1 parent 5e521fb commit e80931f

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed

advisor/dist/index.js

+10-2
Original file line numberDiff line numberDiff line change
@@ -34023,14 +34023,22 @@ async function analyze(name, count, token, owner, repo, branch) {
3402334023
continue;
3402434024
}
3402534025

34026-
const logUploadMatch = log.data.match(/^.* Container for artifact \"(.*-permissions-[a-z0-9]+)\" successfully created\. Starting upload of file\(s\)$/m);
34027-
if (!logUploadMatch)
34026+
const logUploadMatch = log.data.match(/([^ "]+-permissions-[a-z0-9]{32})/m);
34027+
if (!logUploadMatch) {
34028+
if (process.env.RUNNER_DEBUG) {
34029+
console.log(`Cannot find the magic string. Skipping.`);
34030+
}
3402834031
continue;
34032+
}
3402934033
const artifactName = logUploadMatch[1];
34034+
if (process.env.RUNNER_DEBUG)
34035+
console.log(`Looking for artifactName ${artifactName}`);
3403034036
const jobName = artifactName.split('-').slice(0, -2).join('-');
3403134037

3403234038
for (const artifact of artifacts.data.artifacts) {
3403334039
if (artifact.name === artifactName) {
34040+
if (process.env.RUNNER_DEBUG)
34041+
console.log(`Downloading artifact id ${artifact.id}`);
3403434042
const download = await octokit.rest.actions.downloadArtifact({
3403534043
owner: owner,
3403634044
repo: repo,

advisor/index.js

+10-2
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,22 @@ async function analyze(name, count, token, owner, repo, branch) {
6262
continue;
6363
}
6464

65-
const logUploadMatch = log.data.match(/^.* Container for artifact \"(.*-permissions-[a-z0-9]+)\" successfully created\. Starting upload of file\(s\)$/m);
66-
if (!logUploadMatch)
65+
const logUploadMatch = log.data.match(/([^ "]+-permissions-[a-z0-9]{32})/m);
66+
if (!logUploadMatch) {
67+
if (process.env.RUNNER_DEBUG) {
68+
console.log(`Cannot find the magic string. Skipping.`);
69+
}
6770
continue;
71+
}
6872
const artifactName = logUploadMatch[1];
73+
if (process.env.RUNNER_DEBUG)
74+
console.log(`Looking for artifactName ${artifactName}`);
6975
const jobName = artifactName.split('-').slice(0, -2).join('-');
7076

7177
for (const artifact of artifacts.data.artifacts) {
7278
if (artifact.name === artifactName) {
79+
if (process.env.RUNNER_DEBUG)
80+
console.log(`Downloading artifact id ${artifact.id}`);
7381
const download = await octokit.rest.actions.downloadArtifact({
7482
owner: owner,
7583
repo: repo,

0 commit comments

Comments
 (0)