feat: actually sync repos
All checks were successful
Build and Push Docker Image / build (push) Successful in 13s

This commit is contained in:
Pihkaal
2025-12-21 17:19:46 +01:00
parent 999848d581
commit cb42b224e4
2 changed files with 10 additions and 2 deletions

View File

@@ -2,6 +2,7 @@ import express from "express";
import crypto from "crypto";
import { z } from "zod";
import { env } from "./env";
import { syncGiteaRewrites } from "./sync";
const webhookSchema = z.object({
action: z.enum(["deleted", "created"]),
@@ -45,7 +46,11 @@ app.post("/", async (req, res) => {
}
const { action } = result.data;
console.log(`Webhook received: ${action}`);
console.log(`Received event: ${action}`);
console.log("Synchronizing...");
const repos = await syncGiteaRewrites();
console.log(`Done (${repos.length}): ${repos.join(", ")}`);
res.sendStatus(200);
});
@@ -53,3 +58,5 @@ app.post("/", async (req, res) => {
app.listen(env.PORT, () => {
console.log(`Server running on port ${env.PORT}`);
});
await syncGiteaRewrites();

View File

@@ -62,7 +62,8 @@ const createOutputFile = async (repos: string[]): Promise<void> => {
}
};
export const syncGiteaRewrites = async (): Promise<void> => {
export const syncGiteaRewrites = async (): Promise<string[]> => {
const repos = await fetchGiteaRepos();
await createOutputFile(repos);
return repos;
};