MCPcopy Create free account
hub / github.com/ChrisFeldmeier/OpenCodeRust / gh_run

Function gh_run

crates/opencode-cli/src/main.rs:4846–4860  ·  view source on GitHub ↗
(args: &[&str], token: Option<&str>)

Source from the content-addressed store, hash-verified

4844}
4845
4846fn 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
4862fn github_default_branch(owner: &str, repo: &str, token: Option<&str>) -> anyhow::Result<String> {
4863 let endpoint = format!("repos/{owner}/{repo}");

Callers 1

Calls 3

newFunction · 0.85
outputMethod · 0.80
successMethod · 0.45

Tested by

no test coverage detected