Skip to content

Commit

Permalink
Take screenshots from the latest attempt
Browse files Browse the repository at this point in the history
  • Loading branch information
davidfou committed Nov 10, 2024
1 parent 0c174fb commit 3d6a4ee
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion scripts/getScreenshotsFromCI.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,16 @@ try {
})
.then((body) => body.data.artifacts);

const latestArtifacts = artifacts.reduce((acc, current) => {
acc[current.name] ??= current;
if (acc[current.name].created_at < current.created_at) {
acc[current.name] = current;
}
return acc;
}, {});

await Promise.all(
artifacts.map(async (artifact) => {
Object.values(latestArtifacts).map(async (artifact) => {
const filename = path.join(outDir, `${artifact.name}.zip`);
const { data } = await client.rest.actions.downloadArtifact({
...basePayload,
Expand Down

0 comments on commit 3d6a4ee

Please sign in to comment.