diff --git a/src/server/actors/repo/mod.rs b/src/server/actors/repo/mod.rs index 3223d7d..72d0a29 100644 --- a/src/server/actors/repo/mod.rs +++ b/src/server/actors/repo/mod.rs @@ -100,7 +100,15 @@ impl Handler for RepoActor { info!("Message Received"); let gitdir = self.details.gitdir.clone(); match self.forge.repo_clone(gitdir) { - Ok(_) => ctx.address().do_send(LoadConfigFromRepo), + Ok(_) => { + if self.details.repo_config.is_none() { + ctx.address().do_send(LoadConfigFromRepo); + } else { + ctx.address().do_send(ValidateRepo { + message_token: self.message_token, + }); + } + } Err(err) => warn!("Could not Clone repo: {err}"), } } @@ -134,17 +142,7 @@ impl Handler for RepoActor { info!("Message Received"); let repo_config = msg.0; self.details.repo_config.replace(repo_config); - if self.webhook_id.is_none() { - webhook::register( - self.details.clone(), - self.webhook.clone(), - ctx.address(), - self.net.clone(), - ) - .in_current_span() - .into_actor(self) - .wait(ctx); - } + ctx.address().do_send(ValidateRepo { message_token: self.message_token, }); @@ -179,6 +177,17 @@ impl Handler for RepoActor { } } info!("Message Received"); + if self.webhook_id.is_none() { + webhook::register( + self.details.clone(), + self.webhook.clone(), + ctx.address(), + self.net.clone(), + ) + .in_current_span() + .into_actor(self) + .wait(ctx); + } if let Some(repo_config) = self.details.repo_config.clone() { let forge = self.forge.clone(); let addr = ctx.address();