diff --git a/contentctl/actions/release_notes.py b/contentctl/actions/release_notes.py index d9272129..a43ede8b 100644 --- a/contentctl/actions/release_notes.py +++ b/contentctl/actions/release_notes.py @@ -1,10 +1,12 @@ -from contentctl.objects.config import release_notes -from git import Repo -import re -import yaml import pathlib +import re from typing import List, Union +import yaml +from git import Repo + +from contentctl.objects.config import release_notes + class ReleaseNotes: def create_notes( @@ -171,13 +173,13 @@ def create_notes( def release_notes(self, config: release_notes) -> None: ### Remove hard coded path - directories = [ - "detections/", - "stories/", - "macros/", - "lookups/", - "playbooks/", - "ssa_detections/", + directories: list[pathlib.Path] = [ + config.path / "detections", + config.path / "stories", + config.path / "macros", + config.path / "lookups", + config.path / "playbooks", + config.path / "ssa_detections", ] repo = Repo(config.path) @@ -229,7 +231,7 @@ def release_notes(self, config: release_notes) -> None: file_path = pathlib.Path(diff.a_path) # Check if the file is in the specified directories - if any(str(file_path).startswith(directory) for directory in directories): + if any(file_path.is_relative_to(directory) for directory in directories): # Check if a file is Modified if diff.change_type == "M": modified_files.append(file_path)