diff --git a/vibi-dpu/src/db/prs.rs b/vibi-dpu/src/db/prs.rs index 89b28ef3..9e0523b1 100644 --- a/vibi-dpu/src/db/prs.rs +++ b/vibi-dpu/src/db/prs.rs @@ -1,6 +1,5 @@ use serde_json::Value; use sled::IVec; -use std::error::Error; use crate::db::config::get_db; use crate::utils::pr_info::PrInfo; diff --git a/vibi-dpu/src/pubsub/listener.rs b/vibi-dpu/src/pubsub/listener.rs index 618b0ea4..a34b1abe 100644 --- a/vibi-dpu/src/pubsub/listener.rs +++ b/vibi-dpu/src/pubsub/listener.rs @@ -55,11 +55,12 @@ async fn process_message(attributes: &HashMap, data_bytes: &Vec< let pr_number = deserialised_msg_data["eventPayload"]["pullrequest"]["id"].to_string().trim_matches('"').to_string(); let event_type = deserialised_msg_data["eventType"].to_string().trim_matches('"').to_string(); let mut is_reviewable = false; + is_reviewable = process_and_update_pr_if_different(&deserialised_msg_data["eventPayload"], &workspace_slug, &repo_slug, &pr_number, &repo_provider).await; - if event_type == "pullrequest:updated" { - is_reviewable = process_and_update_pr_if_different(&deserialised_msg_data["eventPayload"], &workspace_slug, &repo_slug, &pr_number, &repo_provider).await; + if event_type == "pullrequest:approved" { + todo!("Process approved event"); } - if is_reviewable || event_type == "pullrequest:created" || event_type == "pullrequest:approved" { + if is_reviewable || event_type == "pullrequest:created" || event_type == "pullrequest:updated" { task::spawn(async move { process_review(&data_bytes_async).await; println!("Processed webhook callback message");