Skip to content

Commit 629bd88

Browse files
authored
Merge pull request #393 from splunk/fix_release_notes_directory_paths
Fix pathing issue on Windows and Cleanup Typing Given this is a small change, I am merging myself.
2 parents 5daee4a + 9f86535 commit 629bd88

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

contentctl/actions/release_notes.py

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
from contentctl.objects.config import release_notes
2-
from git import Repo
3-
import re
4-
import yaml
51
import pathlib
2+
import re
63
from typing import List, Union
74

5+
import yaml
6+
from git import Repo
7+
8+
from contentctl.objects.config import release_notes
9+
810

911
class ReleaseNotes:
1012
def create_notes(
@@ -171,13 +173,13 @@ def create_notes(
171173

172174
def release_notes(self, config: release_notes) -> None:
173175
### Remove hard coded path
174-
directories = [
175-
"detections/",
176-
"stories/",
177-
"macros/",
178-
"lookups/",
179-
"playbooks/",
180-
"ssa_detections/",
176+
directories: list[pathlib.Path] = [
177+
config.path / "detections",
178+
config.path / "stories",
179+
config.path / "macros",
180+
config.path / "lookups",
181+
config.path / "playbooks",
182+
config.path / "ssa_detections",
181183
]
182184

183185
repo = Repo(config.path)
@@ -229,7 +231,7 @@ def release_notes(self, config: release_notes) -> None:
229231
file_path = pathlib.Path(diff.a_path)
230232

231233
# Check if the file is in the specified directories
232-
if any(str(file_path).startswith(directory) for directory in directories):
234+
if any(file_path.is_relative_to(directory) for directory in directories):
233235
# Check if a file is Modified
234236
if diff.change_type == "M":
235237
modified_files.append(file_path)

0 commit comments

Comments
 (0)