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

Function upload

packages/core/src/lib/upload.ts:15–45  ·  view source on GitHub ↗
(options: UploadOptions)

Source from the content-addressed store, hash-verified

13 * Uploads collected audits to the portal
14 */
15export async function upload(options: UploadOptions) {
16 await logger.task('Uploading report to Portal', async () => {
17 const portalClient = await loadPortalClient();
18 const { uploadReportToPortal } = portalClient;
19 const { apiKey, server, organization, project, timeout } = options.upload;
20 const report: Report = await loadReport({
21 ...options.persist,
22 format: 'json',
23 });
24 if (!report.commit) {
25 throw new Error('Commit must be linked in order to upload report');
26 }
27
28 const data: SaveReportMutationVariables = {
29 organization,
30 project,
31 commit: report.commit.hash,
32 ...reportToGQL(report),
33 };
34
35 const { url } = await uploadReportToPortal({
36 apiKey,
37 server,
38 data,
39 timeout,
40 });
41 logger.info(formatAsciiLink(url));
42
43 return `Uploaded report to Portal`;
44 });
45}

Callers 4

yargsUploadCommandObjectFunction · 0.90
historyFunction · 0.85

Calls 6

loadReportFunction · 0.90
formatAsciiLinkFunction · 0.90
loadPortalClientFunction · 0.85
reportToGQLFunction · 0.85
taskMethod · 0.80
infoMethod · 0.80

Tested by

no test coverage detected