Skip to content

Commit 3c0d723

Browse files
committed
some more fixes?
1 parent 4797ee4 commit 3c0d723

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

dev-packages/size-limit-gh-action/index.mjs

+7
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,11 @@ async function getArtifactsForBranchAndWorkflow(octokit, { owner, repo, workflow
386386
// Do not allow downloading artifacts from a fork.
387387
const filtered = response.data.filter(workflowRun => workflowRun.head_repository.full_name === `${owner}/${repo}`);
388388

389+
// Sort to ensure the latest workflow run is the first
390+
filtered.sort((a, b) => {
391+
return new Date(b.created_at).getTime() - new Date(a.created_at).getTime();
392+
});
393+
389394
// Store the first workflow run, to determine if this is the latest one...
390395
if (!latestWorkflowRun) {
391396
latestWorkflowRun = filtered[0];
@@ -416,6 +421,8 @@ async function getArtifactsForBranchAndWorkflow(octokit, { owner, repo, workflow
416421
workflowRun,
417422
isLatest: latestWorkflowRun.id === workflowRun.id,
418423
};
424+
} else {
425+
core.info(`No artifact found for ${artifactName}, trying next workflow run...`);
419426
}
420427
}
421428
}

0 commit comments

Comments
 (0)