sparrow/cmd_handlers/
handle_github_cmd.rs1pub fn handle_github(action: sparrow::cli::GithubAction) -> anyhow::Result<()> {
3 use sparrow::cli::GithubAction;
4 use sparrow::github;
5
6 match action {
7 GithubAction::Review {
8 pr,
9 dry_run,
10 model,
11 allowed_tools,
12 } => {
13 let mut plan = github::plan_review(pr, model, allowed_tools, dry_run);
14 if dry_run {
15 println!("{}", serde_json::to_string_pretty(&plan)?);
16 return Ok(());
17 }
18 github::require_action_env()?;
19 plan.diff_preview = github::fetch_pr_diff(pr)?;
20 println!("{}", serde_json::to_string_pretty(&plan)?);
24 }
25 GithubAction::Status => {
26 github::require_action_env()?;
27 println!("{}", github::ci_status()?);
28 }
29 GithubAction::Logs { run_id } => {
30 github::require_action_env()?;
31 println!("{}", github::ci_logs(&run_id)?);
32 }
33 }
34 Ok(())
35}
36
37