( uploadConfig: UploadConfig, commits: NonNullable<ReportsDiff['commits']>, )
| 132 | } |
| 133 | |
| 134 | async 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 | |
| 164 | function getLabelFromReports(reports: Diff<Report>): string | undefined { |
| 165 | if ( |
no test coverage detected