use actix::prelude::*; use git_next_git as git; use tracing::{info, warn}; use crate::{actors::repo::ValidateRepo, gitforge, types::MessageToken}; use super::AdvanceMainTo; pub async fn check_next( next: git::Commit, addr: Addr, forge: gitforge::Forge, message_token: MessageToken, ) { // get the status - pass, fail, pending (all others map to fail, e.g. error) let status = forge.commit_status(&next).await; info!(?status, "Checking next branch"); match status { gitforge::CommitStatus::Pass => { addr.do_send(AdvanceMainTo(next)); } gitforge::CommitStatus::Pending => { tokio::time::sleep(tokio::time::Duration::from_secs(10)).await; addr.do_send(ValidateRepo { message_token }); } gitforge::CommitStatus::Fail => { warn!("Checks have failed"); } } }