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

Function github_default_branch

crates/opencode-cli/src/main.rs:4862–4876  ·  view source on GitHub ↗
(owner: &str, repo: &str, token: Option<&str>)

Source from the content-addressed store, hash-verified

4860}
4861
4862fn github_default_branch(owner: &str, repo: &str, token: Option<&str>) -> anyhow::Result<String> {
4863 let endpoint = format!("repos/{owner}/{repo}");
4864 let value = gh_api_json("GET", &endpoint, None, token)?;
4865 let branch = value
4866 .get("default_branch")
4867 .and_then(|v| v.as_str())
4868 .unwrap_or("main")
4869 .trim()
4870 .to_string();
4871 Ok(if branch.is_empty() {
4872 "main".to_string()
4873 } else {
4874 branch
4875 })
4876}
4877
4878fn github_fetch_pr_runtime_info(
4879 owner: &str,

Callers 1

handle_github_commandFunction · 0.85

Calls 4

gh_api_jsonFunction · 0.85
is_emptyMethod · 0.80
getMethod · 0.45
as_strMethod · 0.45

Tested by

no test coverage detected