Skip to content

Commit

Permalink
bug fix: flow in webhook callback didn't run process_review on pr upd…
Browse files Browse the repository at this point in the history
…ate, and didn't run update-pr-in-db on creation
  • Loading branch information
avikalpg committed Oct 30, 2023
1 parent 3720654 commit ebbde45
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
1 change: 0 additions & 1 deletion vibi-dpu/src/db/prs.rs
Original file line number Diff line number Diff line change
@@ -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;

Expand Down
7 changes: 4 additions & 3 deletions vibi-dpu/src/pubsub/listener.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,12 @@ async fn process_message(attributes: &HashMap<String, String>, 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");
Expand Down

0 comments on commit ebbde45

Please sign in to comment.