from pathlib import Path


def get_changelog_path(value: str) -> Path:
    """
    Get existing path to "CHANGELOG.md" or to its parent folder.

    Arguments:
        value -- String path.

    Returns:
        Path to file.
    """
    path = Path(value).resolve(strict=False)

    if path.exists() and path.is_dir():
        path = path / "CHANGELOG.md"

    return path