( args: BaseReportArgs, )
| 390 | } |
| 391 | |
| 392 | async 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 | |
| 436 | export async function runInBaseBranch<T>( |
| 437 | base: GitBranch, |
no test coverage detected