From c66170c3b442f1f25b7600f595c9dd5540e7b390 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Tue, 9 Apr 2024 22:51:55 +0100 Subject: [PATCH] feat(server): implement repo::status::check_next --- src/server/actors/repo/status.rs | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/src/server/actors/repo/status.rs b/src/server/actors/repo/status.rs index 23aa1f2..2e58c3e 100644 --- a/src/server/actors/repo/status.rs +++ b/src/server/actors/repo/status.rs @@ -1,10 +1,24 @@ -use crate::server::forge; +use actix::prelude::*; + +use crate::server::{ + config::{self, ForgeType}, + forge, +}; + +use super::AdvanceMainTo; pub async fn check_next( - _next: forge::Commit, - _repo_details: crate::server::config::RepoDetails, - _addr: actix::prelude::Addr, - _net: kxio::network::Network, + next: forge::Commit, + repo_details: config::RepoDetails, + addr: Addr, + net: kxio::network::Network, ) { - // TODO: (#13) check statuses for next head - if ok, advance main to next and reassess + let is_success = match repo_details.forge.forge_type { + ForgeType::ForgeJo => { + forge::forgejo::get_commit_status(next.clone(), repo_details, net).await + } + }; + if is_success { + addr.do_send(AdvanceMainTo(next)); + } }