Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 14 additions & 12 deletions contentctl/actions/release_notes.py
Original file line number Diff line number Diff line change
@@ -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(
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
Loading