feat(server): implement repo::status::check_next

This commit is contained in:
Paul Campbell 2024-04-09 22:51:55 +01:00
parent a7a3f8a67b
commit c66170c3b4

View file

@ -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<super::RepoActor>,
_net: kxio::network::Network,
next: forge::Commit,
repo_details: config::RepoDetails,
addr: Addr<super::RepoActor>,
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));
}
}