chore: update src/lib/external-ci.ts
swadhinbiswas committed 8 months ago
00dc778
1 parent fc08744
commit 00dc778
1 file changed
+6 -1
Showing 1 changed file+6-1
▼src/lib/external-ci.ts
+6-1
| @@ -321,6 +321,10 @@ function normalizeStatus(provider: string, rawStatus: string): string { | ||
321 | 321 | */ |
322 | 322 | async function syncStatusToPR(prId: string, checkName: string, status: string): Promise<void> { |
323 | 323 | const db = getDatabase(); |
324 | + const pr = await db.query.pullRequests.findFirst({ | |
325 | + where: eq(schema.pullRequests.id, prId), | |
326 | + }); | |
327 | + if (!pr) return; | |
324 | 328 | |
325 | 329 | const conclusion = status === "success" ? "success" |
326 | 330 | : status === "failure" ? "failure" |
| @@ -340,6 +344,7 @@ async function syncStatusToPR(prId: string, checkName: string, status: string): | ||
340 | 344 | // @ts-expect-error - Drizzle multi-db union type issue |
341 | 345 | await db.update(schema.pullRequestChecks) |
342 | 346 | .set({ |
347 | + headSha: pr.headSha, | |
343 | 348 | status: status === "running" ? "in_progress" : "completed", |
344 | 349 | conclusion, |
345 | 350 | updatedAt: new Date(), |
| @@ -351,7 +356,7 @@ async function syncStatusToPR(prId: string, checkName: string, status: string): | ||
351 | 356 | id: crypto.randomUUID(), |
352 | 357 | pullRequestId: prId, |
353 | 358 | name: checkName, |
354 | - headSha: "", | |
359 | + headSha: pr.headSha, | |
355 | 360 | status: status === "running" ? "in_progress" : "completed", |
356 | 361 | conclusion, |
357 | 362 | createdAt: new Date(), |
358 | 363 | |