Skip to content

Commit

Permalink
Merge pull request #45 from Alokit-Innovations/akg/webhook_callback_f…
Browse files Browse the repository at this point in the history
…low-bugfix

Akg/webhook callback flow bugfix
  • Loading branch information
tapishr authored Oct 30, 2023
2 parents 3720654 + ebbde45 commit 3a591cf
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 3a591cf

Please sign in to comment.