From 0fcc71d02e49257b480970b3221b02c18ff8dd1a Mon Sep 17 00:00:00 2001 From: kuwoyuki Date: Thu, 6 Feb 2025 04:56:13 +0600 Subject: [PATCH] fix: branch --- server.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/server.js b/server.js index b4f37aa..fc2910d 100644 --- a/server.js +++ b/server.js @@ -26,8 +26,7 @@ fastify.post( async (request, reply) => { try { const { - ref, - repository: { clone_url: repoUrl }, + repository: { clone_url: repoUrl, default_branch: branch }, } = request.body; const { code } = await execAsync("git rev-parse --git-dir") @@ -44,8 +43,8 @@ fastify.post( // we won't be able to reply later, so do it here // this doesn't necessarily imply a successful build though // TODO: healthcheck - reply.status(200).send("Updated successfully"); - await execAsync(`git reset --hard ${ref}`); + reply.status(200).send("fetched successfully"); + await execAsync(`git reset --hard origin/${branch}`); await execAsync("npm run build"); } catch (error) { reply.status(500).send("Update failed");