fix: branch

This commit is contained in:
2025-02-06 04:56:13 +06:00
parent 1ee33fb14b
commit 0fcc71d02e

View File

@@ -26,8 +26,7 @@ fastify.post(
async (request, reply) => { async (request, reply) => {
try { try {
const { const {
ref, repository: { clone_url: repoUrl, default_branch: branch },
repository: { clone_url: repoUrl },
} = request.body; } = request.body;
const { code } = await execAsync("git rev-parse --git-dir") 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 // we won't be able to reply later, so do it here
// this doesn't necessarily imply a successful build though // this doesn't necessarily imply a successful build though
// TODO: healthcheck // TODO: healthcheck
reply.status(200).send("Updated successfully"); reply.status(200).send("fetched successfully");
await execAsync(`git reset --hard ${ref}`); await execAsync(`git reset --hard origin/${branch}`);
await execAsync("npm run build"); await execAsync("npm run build");
} catch (error) { } catch (error) {
reply.status(500).send("Update failed"); reply.status(500).send("Update failed");