Skip to content

Commit 3df4a71

Browse files
committed
fix(ci): catch errors from downloadReportArtifact - log warning and proceed
1 parent b7ce1cf commit 3df4a71

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

packages/ci/src/lib/run.ts

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -101,14 +101,16 @@ export async function runInCI(
101101
return { mode: 'standalone', artifacts, newIssues };
102102
}
103103

104-
// eslint-disable-next-line max-lines-per-function
105-
async function runOnProject(args: {
104+
type RunOnProjectArgs = {
106105
project: ProjectConfig | null;
107106
refs: GitRefs;
108107
api: ProviderAPIClient;
109108
settings: Settings;
110109
git: SimpleGit;
111-
}): Promise<ProjectRunResult> {
110+
};
111+
112+
// eslint-disable-next-line max-lines-per-function
113+
async function runOnProject(args: RunOnProjectArgs): Promise<ProjectRunResult> {
112114
const {
113115
project,
114116
refs: { head, base },
@@ -188,18 +190,24 @@ async function runOnProject(args: {
188190
return { ...diffOutput, newIssues };
189191
}
190192

191-
async function collectPreviousReport(args: {
192-
project: ProjectConfig | null;
193+
type CollectPreviousReportArgs = RunOnProjectArgs & {
193194
base: GitBranch;
194-
api: ProviderAPIClient;
195-
settings: Settings;
196195
ctx: CommandContext;
197-
git: SimpleGit;
198-
}): Promise<string | null> {
196+
};
197+
198+
async function collectPreviousReport(
199+
args: CollectPreviousReportArgs,
200+
): Promise<string | null> {
199201
const { project, base, api, settings, ctx, git } = args;
200202
const logger = settings.logger;
201203

202-
const cachedBaseReport = await api.downloadReportArtifact?.(project?.name);
204+
const cachedBaseReport = await api
205+
.downloadReportArtifact?.(project?.name)
206+
.catch((error: unknown) => {
207+
logger.warn(
208+
`Error when downloading previous report artifact, skipping - ${stringifyError(error)}`,
209+
);
210+
});
203211
if (api.downloadReportArtifact != null) {
204212
logger.info(
205213
`Previous report artifact ${cachedBaseReport ? 'found' : 'not found'}`,

0 commit comments

Comments
 (0)