from pathlib import Path
from typing import List


def get_sorted_version_directories(changelog_path: Path) -> List[Path]:
    """Get all version directories and return them sorted as list."""
    directories = [item for item in changelog_path.iterdir() if item.is_dir()]
    return sorted(
        directories,
        reverse=True,
        key=lambda x: tuple(map(int, x.name.split("."))),
    )