INNER CODE UNIT · Python
fetch_wiki_via_git
epigen/MrBiomics · helpers/MrBiomics_context_crawler.py:157
def fetch_wiki_via_git(repo: RepoSpec, token: Optional[str] = None) -> tuple[str, str, str]:
"""
Clone the wiki git repository, concatenate pages with separators, and return
the digest along with HEAD commit metadata.
"""
clone_url = repo.url
if token:
clone_url = clone_url.replace("https://", f"https://{token}:x-oauth-basic@")
with tempfile.TemporaryDirectory() as tmpdir:
try:
subprocess.run(
["git", "clone", "--depth=1", clone_url, tmpdir],
check=True,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
)
except subprocess.CalledProcessError as exc: