From 6b52e1e957fb9e6d85a0dcad6682d5821ef01a7a Mon Sep 17 00:00:00 2001 From: augustuswm Date: Thu, 25 Jan 2024 09:34:50 -0600 Subject: [PATCH] Re-enable rfd jobs --- webhooky/src/handlers_github/mod.rs | 74 ++++++++++++++--------------- webhooky/src/server.rs | 6 +-- 2 files changed, 40 insertions(+), 40 deletions(-) diff --git a/webhooky/src/handlers_github/mod.rs b/webhooky/src/handlers_github/mod.rs index cc9926020..9a0ef6a2b 100644 --- a/webhooky/src/handlers_github/mod.rs +++ b/webhooky/src/handlers_github/mod.rs @@ -156,43 +156,43 @@ pub async fn handle_github(rqctx: &RequestContext, event: GitHubW let github = Arc::new(company.authenticate_github()?); match repo_name { - // Repo::RFD => match event_type { - // EventType::Push => { - // match handle_rfd_push(github.clone(), &api_context.app, event.clone()).await { - // Ok(_) => ( /* Silence */ ), - // Err(e) => { - // event - // .create_comment(&github, &event.get_error_string("updating RFD on `push`", e)) - // .await?; - // } - // } - // } - // EventType::PullRequest => { - // // Let's create the check run. - // let check_run_id = event.create_check_run(&github).await?; - - // match handle_rfd_pull_request(&api_context.app, event.clone(), &company).await { - // Ok((conclusion, message)) => { - // event - // .update_check_run(&github, check_run_id, &message, conclusion) - // .await?; - // } - // Err(e) => { - // event - // .update_check_run( - // &github, - // check_run_id, - // &event.get_error_string("updating RFD on `pull_request`", e), - // octorust::types::ChecksCreateRequestConclusion::Failure, - // ) - // .await?; - // } - // } - // } - // EventType::CheckRun => {} - // EventType::CheckSuite => {} - // _ => (), - // }, + Repo::RFD => match event_type { + EventType::Push => { + match handle_rfd_push(github.clone(), &api_context.app, event.clone()).await { + Ok(_) => ( /* Silence */ ), + Err(e) => { + event + .create_comment(&github, &event.get_error_string("updating RFD on `push`", e)) + .await?; + } + } + } + EventType::PullRequest => { + // Let's create the check run. + let check_run_id = event.create_check_run(&github).await?; + + match handle_rfd_pull_request(&api_context.app, event.clone(), &company).await { + Ok((conclusion, message)) => { + event + .update_check_run(&github, check_run_id, &message, conclusion) + .await?; + } + Err(e) => { + event + .update_check_run( + &github, + check_run_id, + &event.get_error_string("updating RFD on `pull_request`", e), + octorust::types::ChecksCreateRequestConclusion::Failure, + ) + .await?; + } + } + } + EventType::CheckRun => {} + EventType::CheckSuite => {} + _ => (), + }, Repo::Configs => { if let EventType::Push = event_type { match handle_configs_push(&github, &api_context.app, event.clone(), &company).await { diff --git a/webhooky/src/server.rs b/webhooky/src/server.rs index 79f347d01..25e5fc0ba 100644 --- a/webhooky/src/server.rs +++ b/webhooky/src/server.rs @@ -276,9 +276,9 @@ pub async fn server( scheduler .every(16.hours()) .run(enclose! { (server_context) move || create_do_job_fn(server_context.clone(), "sync-repos")}); - // scheduler - // .every(14.hours()) - // .run(enclose! { (server_context) move || create_do_job_fn(server_context.clone(), "sync-rfds")}); + scheduler + .every(14.hours()) + .run(enclose! { (server_context) move || create_do_job_fn(server_context.clone(), "sync-rfds")}); scheduler .every(30.minutes()) .run(enclose! { (server_context) move || create_do_job_fn(server_context.clone(), "sync-salesforce")});