first comment ! :D

This commit is contained in:
2026-06-02 20:30:02 +00:00
parent 10ebee389e
commit 4966d08d18
3 changed files with 61 additions and 7 deletions
+18 -2
View File
@@ -1,3 +1,5 @@
use std::time::Duration;
use crate::{
env::EnvConfig,
errors::AppError,
@@ -12,7 +14,7 @@ pub struct Bot {
impl Bot {
pub fn new(config: EnvConfig) -> Self {
Self {
gitea_api: GiteaAPI::new(&config.gitea_url),
gitea_api: GiteaAPI::new(&config.gitea_url, &config.gitea_token),
config,
}
}
@@ -36,11 +38,25 @@ impl Bot {
match exec_result {
Ok(_) => println!("Task completed"),
Err(_) => println!("Task errored"),
Err(err) => println!("{}", err),
}
}
pub async fn exec_review(&self, review_payload: ReviewPayload) -> Result<(), AppError> {
let new_comment = self
.gitea_api
.comment(
&review_payload.repository.full_name,
review_payload.pull_request.number,
)
.await?;
tokio::time::sleep(Duration::from_secs(10)).await;
self.gitea_api
.edit_comment(&review_payload.repository.full_name, new_comment.id)
.await?;
Ok(())
}
}