git-next/src/server/actors/repo/status.rs
Paul Campbell 0d57ee7bc0
All checks were successful
ci/woodpecker/push/cron-docker-builder Pipeline was successful
ci/woodpecker/push/tag-created Pipeline was successful
ci/woodpecker/push/push-next Pipeline was successful
refactor(gitforge): migrate some types from forge
2024-04-18 19:18:27 +01:00

29 lines
837 B
Rust

use actix::prelude::*;
use gix::trace::warn;
use tracing::info;
use crate::server::{actors::repo::ValidateRepo, gitforge};
use super::AdvanceMainTo;
pub async fn check_next(
next: gitforge::Commit,
addr: Addr<super::RepoActor>,
forge: gitforge::Forge,
) {
// 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);
}
gitforge::CommitStatus::Fail => {
warn!("Checks have failed");
}
}
}