From 46e8248f7e33163dfc6749212c78604be0cdeb83 Mon Sep 17 00:00:00 2001 From: Sourodip-1 Date: Tue, 18 Aug 2026 17:45:33 +0530 Subject: [PATCH] fix --- src/app/api/github/webhooks/route.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/app/api/github/webhooks/route.ts b/src/app/api/github/webhooks/route.ts index 323a34c..0fd1785 100644 --- a/src/app/api/github/webhooks/route.ts +++ b/src/app/api/github/webhooks/route.ts @@ -57,14 +57,17 @@ export async function POST(req: NextRequest) { // Determine the "new version" based on the commit SHA or we can just bump a timestamp const newVersion = payload.head_commit?.id?.substring(0, 7) || Date.now().toString(); - // Trigger update asynchronously so we don't timeout the webhook response - TemplateUpdateService.propagateUpdate(templateType, newVersion, repoOwner, defaultBranch).catch(err => { - console.error(`Async propagation failed for ${templateType}:`, err); - }); + console.log(`[Webhook] Processing push event. Repo: ${repoName}, Owner: ${repoOwner}, Branch: ${defaultBranch}, Type: ${templateType}, Version: ${newVersion}`); + + // Await the update so we can return the exact results in the response for debugging + const result = await TemplateUpdateService.propagateUpdate(templateType, newVersion, repoOwner, defaultBranch); + + console.log('[Webhook] Propagation result:', result); return NextResponse.json({ success: true, - message: `Triggered update for ${templateType} with version ${newVersion}` + message: `Completed update for ${templateType} with version ${newVersion}`, + result }); } catch (error: any) { console.error('Error handling GitHub webhook:', error);