From a200d07370afe9165d7552a72f867483055866c3 Mon Sep 17 00:00:00 2001 From: "pullfrog[bot]" <226033991+pullfrog[bot]@users.noreply.github.com> Date: Wed, 28 Jan 2026 00:40:56 +0000 Subject: [PATCH] feat: Immediate Leaping into action (#146) * feat: post "Leaping..." comment immediately without polling GitHub API This change makes the initial comment response much faster by avoiding the expensive GitHub API polling that was waiting for workflows to dequeue (up to 12s+ in some cases). New architecture: 1. Create WorkflowRun record BEFORE dispatching (no runId yet) 2. Post "Leaping into action..." comment with shortlink URL immediately 3. Dispatch workflow and return 4. workflow_run.requested webhook fills in runId when GitHub dequeues Shortlink redirect at /api/workflow-run/[id]/logs: - If runId available: redirects to GitHub workflow run - If runId null: shows polling page that checks DB every 1.5s Changes: - Make `runId` optional on WorkflowRun model (filled in via webhook) - Add `workflow_run` to expected webhook events - Add handler for workflow_run.requested to update DB with runId - Create /api/workflow-run/[id]/logs shortlink redirect route - Refactor triggerWorkflow.ts to use eager comment pattern - Update trigger page to use new pattern Closes #141 * chore: add migration for nullable runId in WorkflowRun * fix: rm dead code. * fix: Adjusting the issueNumber prop usage comment. * fix: shortening and JSDoc for createWorkflowRunRecord. * fix: Reducing diff, reducing confusion on naming the id. * Revert "fix: Adjusting the issueNumber prop usage comment." This reverts commit 34d87c2f8bc58782a53ce5eb14a40935232a4924. * refactor: reuse buildShortlinkUrl in trigger page * fix: Reducing confusion on param naming. * fix: shorter JSDoc. * Apply suggestion from @RobinTail * chore: remove unnecessary JSDoc comment from buildShortlinkUrl * Revert "chore: remove unnecessary JSDoc comment from buildShortlinkUrl" This reverts commit 491ba6ba3f31c874c9f391871739efa50adb0446. * fix: confusing naming of var. * fix: redundant 'let'. * refactor: move route from `/api/workflow-run/[id]/logs` to `/api/workflow-run-logs/[id]` Avoids confusion with existing `/api/workflow-run/[runId]` route which uses GitHub's runId, whereas this new route uses the internal WorkflowRun record id. * chore: remove old route directory * refactor: reuse `buildShortlinkUrl()` with `shouldPoll` param * refactor: add script prop to generateLeapingLoaderHtml Instead of string-replacing to inject scripts, the function now accepts an optional script prop that gets wrapped in