diff --git a/src/devx/ci/sync_wiki.py b/src/devx/ci/sync_wiki.py index ab69ac7..86adf97 100644 --- a/src/devx/ci/sync_wiki.py +++ b/src/devx/ci/sync_wiki.py @@ -32,6 +32,7 @@ import re import subprocess # nosec B404 import tempfile from pathlib import Path +from urllib.parse import urlparse import click from dotenv import load_dotenv # pyright: ignore[reportMissingImports,reportUnknownVariableType] @@ -102,7 +103,10 @@ def get_wiki_clone_url(owner: str, repo: str, token: str) -> str: # Gitea wiki repos are at {clone_url}.wiki.git # Extract base URL from API URL base = GITEA_API_URL.rsplit("/api/v1", 1)[0] - return f"{base}/{owner}/{repo}.wiki.git" + # Embed token in URL for both clone and push auth + # Format: https://token@host/owner/repo.wiki.git + parsed = urlparse(base) + return f"{parsed.scheme}://{token}@{parsed.hostname}/{owner}/{repo}.wiki.git" def clone_wiki(wiki_url: str, dest: Path) -> bool: