use actix::prelude::*; use tracing::info; use crate::server::{ config::{self, ForgeType}, forge, }; use super::AdvanceMainTo; pub async fn check_next( next: forge::Commit, repo_details: config::RepoDetails, addr: Addr, net: kxio::network::Network, ) { // get the status - pass, fail, pending (all others map to fail, e.g. error) let status = match repo_details.forge.forge_type { ForgeType::ForgeJo => { forge::forgejo::get_commit_status(next.clone(), repo_details, net).await } }; info!(?status, "Checking next branch status"); match status { Status::Pass => { addr.do_send(AdvanceMainTo(next)); } Status::Pending => (), // TODO: (#22) wait and try again OR can webhook tell us when it's done, in // which case we can do nothing here and wait for the webhook to trigger Status::Fail => (), // TODO: (#21) reset next and wait for dev to be updated and this // commit removed from the commit history before trying again } } #[derive(Debug)] pub enum Status { Pass, Fail, Pending, }