Skip to content

Commit

Permalink
Add meaningful error when build expires
Browse files Browse the repository at this point in the history
  • Loading branch information
Janpot committed Mar 29, 2023
1 parent 1d5189f commit 17c5e3e
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions tools-public/toolpad/bundleSizeQueries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,18 @@ async function getBaseSnapshot(baseRef: string, baseCommit: string) {
}

async function getTargetSnapshot(circleCIBuildNumber: string) {
const { data: artifacts } = await axios.get(
`https://circleci.com/api/v2/project/gh/mui/material-ui/${encodeURIComponent(
circleCIBuildNumber
)}/artifacts`
);
const artifactsUrl = `https://circleci.com/api/v2/project/gh/mui/material-ui/${encodeURIComponent(
circleCIBuildNumber
)}/artifacts`;
const { data: artifacts } = await axios.get(artifactsUrl);
const entry = artifacts.items.find(
(entry) => entry.path === "size-snapshot.json"
);
if (!entry) {
throw new Error(
`No artifacts found for build ${circleCIBuildNumber} (${artifactsUrl})`
);
}
const { data } = await axios.get(entry.url);
return data;
}
Expand Down

0 comments on commit 17c5e3e

Please sign in to comment.