def get_latest_version_tag(repo_path):
    """Get the latest version tag from the repository."""
    try:
        # Fetch all tags from remote
        subprocess.run(
            ["git", "-C", repo_path, "fetch", "--tags"],
            check=True,
            capture_output=True,
        )

        # Get the latest version tag (sorted by version)
        result = subprocess.run(
            [
                "git",
                "-C",
                repo_path,
                "tag",
                "-l",
                "v*",
                "--sort=-version:refname",
            ],
            check=True,
            capture_output=True,
            text=True,
        )

        tags = result.stdout.strip().split("\n")
        if tags and tags[0]:
            return tags[0]
        else:
            print("No version tags found, falling back to main branch")
            return "main"
    except subprocess.CalledProcessError as e:
        print(f"Error getting latest tag: {e}")
        return "main"
Get the latest version tag from the repository.
docs/scripts/merge_llama_deploy_docs.py