diff --git a/packages/canyon-collect/src/apps/collect/services/coverage-map-client.service.ts b/packages/canyon-collect/src/apps/collect/services/coverage-map-client.service.ts index 429b421b..c06460c1 100755 --- a/packages/canyon-collect/src/apps/collect/services/coverage-map-client.service.ts +++ b/packages/canyon-collect/src/apps/collect/services/coverage-map-client.service.ts @@ -17,6 +17,23 @@ import { coverageObj } from '../models/coverage.model'; export class CoverageMapClientService { constructor(private readonly prisma: PrismaService) {} async invoke({ sha, projectID, coverage, instrumentCwd, branch }) { + // 先检查有没有 + const exist = await this.prisma.coverage.findFirst({ + where: { + sha: sha, + projectID: projectID, + covType: 'all', + }, + }); + + if (exist) { + return { + id: exist.id, + projectID: exist.projectID, + sha: exist.sha, + }; + } + const coverageObject = typeof coverage === 'string' ? JSON.parse(coverage) : coverage;