git-next/crates/repo-actor/src/status.rs

33 lines
880 B
Rust
Raw Normal View History

//
use actix::prelude::*;
use git_next_git as git;
2024-05-19 16:07:29 +01:00
use tracing::{info, warn};
use crate::{MessageToken, ValidateRepo};
use super::AdvanceMainTo;
pub async fn check_next(
next: git::Commit,
addr: Addr<super::RepoActor>,
forge: git_next_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;
2024-04-12 17:41:09 +01:00
info!(?status, "Checking next branch");
match status {
git::commit::Status::Pass => {
addr.do_send(AdvanceMainTo(next));
}
git::commit::Status::Pending => {
tokio::time::sleep(tokio::time::Duration::from_secs(10)).await;
addr.do_send(ValidateRepo { message_token });
}
git::commit::Status::Fail => {
warn!("Checks have failed");
}
}
}