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

Function fetchPortalComparisonLink

packages/core/src/lib/compare.ts:134–162  ·  view source on GitHub ↗
(
  uploadConfig: UploadConfig,
  commits: NonNullable<ReportsDiff['commits']>,
)

Source from the content-addressed store, hash-verified

132}
133
134async function fetchPortalComparisonLink(
135 uploadConfig: UploadConfig,
136 commits: NonNullable<ReportsDiff['commits']>,
137): Promise<string | undefined> {
138 const { server, apiKey, organization, project } = uploadConfig;
139 const portalClient = await loadPortalClient();
140 if (!portalClient) {
141 return;
142 }
143 const { PortalOperationError, getPortalComparisonLink } = portalClient;
144 try {
145 return await getPortalComparisonLink({
146 server,
147 apiKey,
148 parameters: {
149 organization,
150 project,
151 before: commits.before.hash,
152 after: commits.after.hash,
153 },
154 });
155 } catch (error) {
156 if (error instanceof PortalOperationError) {
157 logger.warn(`Failed to fetch portal comparison link - ${error.message}`);
158 return undefined;
159 }
160 throw error;
161 }
162}
163
164function getLabelFromReports(reports: Diff<Report>): string | undefined {
165 if (

Callers 1

compareReportFilesFunction · 0.85

Calls 2

loadPortalClientFunction · 0.85
warnMethod · 0.80

Tested by

no test coverage detected