From bafb6fe93bde281b8bf3c5b6a96343834e525930 Mon Sep 17 00:00:00 2001 From: Corey Johnson Date: Tue, 10 Mar 2026 10:38:29 -0700 Subject: [PATCH] Document Gitea webhook setup and fix log file sidebar sorting - Add setup instructions for system-wide and org/repo webhooks - Fix sidebar to sort log file groups by most recent file timestamp - Maintains chronological order when viewing logs across different git commits Co-Authored-By: Claude Haiku 4.5 --- packages/spike/README.md | 10 +++++++++- packages/spike/src/server/logs.tsx | 7 +++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/packages/spike/README.md b/packages/spike/README.md index 31d392e..a9707a0 100644 --- a/packages/spike/README.md +++ b/packages/spike/README.md @@ -10,7 +10,15 @@ Discord-Gitea bridge bot. When someone opens a PR or leaves a comment on [git.no 4. `bun run subdomain:dev` to start the server. 5. Visit `localhost:3000/discord/auth` to authorize the bot to your Discord server. 6. Use [Tailscale Funnel](https://tailscale.com/kb/1223/funnel) or ngrok to expose your local server to the internet. -7. Add a Gitea webhook at `https://git.nose.space//settings/hooks` pointing to `https:///gitea/webhook`. +7. Add a Gitea webhook (see below). + +### Gitea webhook + +Spike needs a webhook so Gitea sends PR and comment events to it. You have two options: + +**System webhook (covers all repos)** — Requires Gitea admin access. Go to **Site Administration > System Webhooks > Add Webhook > Gitea**. Set the target URL to `https://spike.theworkshop.cc/gitea/webhook`. Under "Trigger On", select **Custom Events** and enable Pull Request, Issue Comment, and Pull Request Comment. This fires for every repo on the instance. + +**Org/repo webhook (covers one org or repo)** — Go to the org or repo settings, then **Webhooks > Add Webhook > Gitea**. Same target URL and event configuration as above. Only fires for that org or repo. ### Environment variables diff --git a/packages/spike/src/server/logs.tsx b/packages/spike/src/server/logs.tsx index 0a2975f..1b9cbb6 100644 --- a/packages/spike/src/server/logs.tsx +++ b/packages/spike/src/server/logs.tsx @@ -47,20 +47,23 @@ function EventRow({ event }: { event: StoredLogEvent }) { } function Sidebar({ files, selectedFile }: { files: string[]; selectedFile?: string }) { - // Group files by sha + // Group files by sha, sorted by most recent file in each group const grouped: Record = {} for (const file of files) { const sha = file.split("_")[0] || "unknown" const list = grouped[sha] || (grouped[sha] = []) list.push(file) } + const sortedGroups = Object.entries(grouped).sort(([, a], [, b]) => { + return b[0]!.localeCompare(a[0]!) + }) return (