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");