Skip to content

Commit 6d6e7e9

Browse files
committed
fix: inject changelog correctly [skip ci]
1 parent 48c24f5 commit 6d6e7e9

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

.github/scripts/inject_changelog.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,22 +40,24 @@ def resolve_original_path(current_path, path_mapping):
4040
"""
4141
Resolve the current file path to the original path using the mapping.
4242
The mapping keys are regrouped paths (without DOCS/), values are original paths (without DOCS/).
43-
Returns the original path WITHOUT DOCS/ prefix to match changelog keys.
43+
Returns the full path WITH DOCS/ prefix to match changelog keys.
4444
"""
4545

46-
# Strip DOCS/ prefix to get lookup path
47-
if current_path.startswith("DOCS/"):
48-
lookup_path = current_path[5:] # Remove "DOCS/"
49-
else:
50-
lookup_path = current_path
46+
# Ensure DOCS/ prefix
47+
if not current_path.startswith("DOCS/"):
48+
current_path = f"DOCS/{current_path}"
49+
50+
# Strip DOCS/ for mapping lookup
51+
lookup_path = current_path[5:] # Remove "DOCS/"
5152

5253
# Direct mapping lookup (lookup_path is the regrouped path, we want the original)
5354
if lookup_path in path_mapping:
5455
original = path_mapping[lookup_path]
55-
return original
56+
# Return with DOCS/ prefix to match changelog keys
57+
return f"DOCS/{original}"
5658

57-
# No mapping found, return lookup path (without DOCS/ prefix for consistency with changelog keys)
58-
return lookup_path
59+
# No mapping found, return current_path (with DOCS/ prefix for consistency with changelog keys)
60+
return current_path
5961

6062

6163
def sanitize_html_summary(summary):

.github/scripts/update_versions_and_changelogs.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -458,13 +458,11 @@ def save_changelogs_for_injection(changelog_entries):
458458
print(f"[WARNING] Could not load existing changelogs: {e}")
459459

460460
# Add new entries for changed files (prepend to history)
461-
# Normalize keys: strip "DOCS/" prefix to match inject_changelog.py expectations
461+
# Keep DOCS/ prefix to match inject_changelog.py expectations
462462
for filepath, new_entry in changelog_entries.items():
463-
# Normalize: DOCS/products/file.qmd → products/file.qmd
463+
# Ensure DOCS/ prefix
464464
normalized_path = (
465-
filepath.replace("DOCS/", "", 1)
466-
if filepath.startswith("DOCS/")
467-
else filepath
465+
filepath if filepath.startswith("DOCS/") else f"DOCS/{filepath}"
468466
)
469467

470468
if normalized_path not in existing_changelogs:

0 commit comments

Comments
 (0)