|
1 |
| -from contentctl.objects.config import release_notes |
2 |
| -from git import Repo |
3 |
| -import re |
4 |
| -import yaml |
5 | 1 | import pathlib
|
| 2 | +import re |
6 | 3 | from typing import List, Union
|
7 | 4 |
|
| 5 | +import yaml |
| 6 | +from git import Repo |
| 7 | + |
| 8 | +from contentctl.objects.config import release_notes |
| 9 | + |
8 | 10 |
|
9 | 11 | class ReleaseNotes:
|
10 | 12 | def create_notes(
|
@@ -171,13 +173,13 @@ def create_notes(
|
171 | 173 |
|
172 | 174 | def release_notes(self, config: release_notes) -> None:
|
173 | 175 | ### 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", |
181 | 183 | ]
|
182 | 184 |
|
183 | 185 | repo = Repo(config.path)
|
@@ -229,7 +231,7 @@ def release_notes(self, config: release_notes) -> None:
|
229 | 231 | file_path = pathlib.Path(diff.a_path)
|
230 | 232 |
|
231 | 233 | # 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): |
233 | 235 | # Check if a file is Modified
|
234 | 236 | if diff.change_type == "M":
|
235 | 237 | modified_files.append(file_path)
|
|
0 commit comments