From d90504b4278ce477813234fa6f4386f716ab8e61 Mon Sep 17 00:00:00 2001 From: damocles Date: Wed, 15 Jul 2026 18:33:09 +0200 Subject: [PATCH] fix(#2417): accept forgejo's 'synchronized' pr-update webhook action --- hive-c0re/src/dashboard/webhook.rs | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/hive-c0re/src/dashboard/webhook.rs b/hive-c0re/src/dashboard/webhook.rs index 76ae260f..b69f052f 100644 --- a/hive-c0re/src/dashboard/webhook.rs +++ b/hive-c0re/src/dashboard/webhook.rs @@ -124,13 +124,14 @@ pub(super) async fn post_webhook_knowledge( /// Minimal Forgejo `pull_request`-webhook payload. /// /// Forgejo fires this for actions: `opened`, `closed`, `reopened`, -/// `synchronize`, `assigned`, `unassigned`, `label_updated`, +/// `synchronized`, `assigned`, `unassigned`, `label_updated`, /// `label_cleared`, `milestoned`, `demilestoned`, `review_requested`, /// `review_request_removed`, `auto_merge_enabled`, `auto_merge_disabled`. -/// We only act on `opened` and `synchronize`. +/// We only act on `opened` and `synchronized` (Forgejo spells the +/// push-update action past-tense, unlike GitHub's `synchronize`). #[derive(Deserialize)] pub(super) struct PrWebhookPayload { - /// What triggered this event (`opened`, `closed`, `synchronize`, …). + /// What triggered this event (`opened`, `closed`, `synchronized`, …). action: Option, /// PR index on the repo. number: Option, @@ -156,7 +157,7 @@ struct PrWebhookRepo { /// POST `/webhook/config-pr` — Forgejo `pull_request` webhook for /// `agent-configs/*` repos. /// -/// On `opened` or `synchronize` for an `agent-configs/` PR: +/// On `opened` or `synchronized` for an `agent-configs/` PR: /// fetches the current PR head sha, queues a `MergeConfigPr` approval row, /// and emits the `ApprovalAdded` event so the dashboard card appears /// immediately. @@ -200,8 +201,13 @@ pub(super) async fn post_webhook_config_pr( }; let action = payload.action.as_deref().unwrap_or(""); - // Only act on newly-opened or force-updated PRs. - if action != "opened" && action != "synchronize" { + // Only act on a newly-opened PR or a new push to its branch. Forgejo's + // webhook payload spells the push-update action `synchronized` (past + // tense), NOT GitHub's `synchronize` — matching only the GitHub spelling + // silently dropped every PR-update delivery (the whole reason updates were + // "only found by poll"). Accept both so the handler is correct against + // Forgejo and stays GitHub-compatible. + if action != "opened" && action != "synchronize" && action != "synchronized" { tracing::debug!(action, "webhook/config-pr: ignoring action"); return (StatusCode::OK, "ignored").into_response(); }