(args: &[&str], token: Option<&str>)
| 4844 | } |
| 4845 | |
| 4846 | fn gh_run(args: &[&str], token: Option<&str>) -> anyhow::Result<()> { |
| 4847 | let mut cmd = ProcessCommand::new("gh"); |
| 4848 | cmd.args(args); |
| 4849 | if let Some(token) = token { |
| 4850 | cmd.env("GH_TOKEN", token); |
| 4851 | } |
| 4852 | let output = cmd |
| 4853 | .output() |
| 4854 | .map_err(|e| anyhow::anyhow!("Failed to run gh {:?}: {}", args, e))?; |
| 4855 | if !output.status.success() { |
| 4856 | let stderr = String::from_utf8_lossy(&output.stderr).trim().to_string(); |
| 4857 | anyhow::bail!("gh {:?} failed: {}", args, stderr); |
| 4858 | } |
| 4859 | Ok(()) |
| 4860 | } |
| 4861 | |
| 4862 | fn github_default_branch(owner: &str, repo: &str, token: Option<&str>) -> anyhow::Result<String> { |
| 4863 | let endpoint = format!("repos/{owner}/{repo}"); |
no test coverage detected