MCPcopy Create free account
hub / github.com/code-pushup/cli / loadCachedBaseReportFromPortal

Function loadCachedBaseReportFromPortal

packages/ci/src/lib/run-utils.ts:392–434  ·  view source on GitHub ↗
(
  args: BaseReportArgs,
)

Source from the content-addressed store, hash-verified

390}
391
392async function loadCachedBaseReportFromPortal(
393 args: BaseReportArgs,
394): Promise<string | null> {
395 const {
396 config,
397 env: { settings },
398 base,
399 } = args;
400
401 if (!config.upload) {
402 return null;
403 }
404
405 const reportPath = await downloadFromPortal({
406 server: config.upload.server,
407 apiKey: config.upload.apiKey,
408 parameters: {
409 organization: config.upload.organization,
410 project: config.upload.project,
411 withAuditDetails: true,
412 ...(!settings.searchCommits && {
413 commit: base.sha,
414 }),
415 ...(typeof settings.searchCommits === 'number' && {
416 maxCommits: settings.searchCommits,
417 }),
418 },
419 }).catch((error: unknown) => {
420 logWarning(
421 `Error when downloading previous report from portal, skipping - ${stringifyError(error)}`,
422 );
423 return null;
424 });
425
426 logInfo(
427 `Previous report ${reportPath ? 'found' : 'not found'} in Code PushUp portal`,
428 );
429 if (reportPath) {
430 logDebug(`Previous report downloaded from portal to ${reportPath}`);
431 }
432
433 return reportPath;
434}
435
436export async function runInBaseBranch<T>(
437 base: GitBranch,

Callers 1

loadCachedBaseReportFunction · 0.85

Calls 5

stringifyErrorFunction · 0.90
downloadFromPortalFunction · 0.85
logWarningFunction · 0.85
logInfoFunction · 0.85
logDebugFunction · 0.85

Tested by

no test coverage detected