File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed
Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -470,8 +470,19 @@ def save_changelogs_for_injection(changelog_entries):
470470 if normalized_path not in existing_changelogs :
471471 existing_changelogs [normalized_path ] = []
472472
473- # Prepend new entry (most recent first)
474- existing_changelogs [normalized_path ].insert (0 , new_entry )
473+ # Check if this version already exists (avoid duplicates)
474+ existing_versions = [entry .get ('version' ) for entry in existing_changelogs [normalized_path ]]
475+ if new_entry ['version' ] in existing_versions :
476+ # Update existing entry instead of adding duplicate
477+ for i , entry in enumerate (existing_changelogs [normalized_path ]):
478+ if entry .get ('version' ) == new_entry ['version' ]:
479+ # Update date and summary
480+ existing_changelogs [normalized_path ][i ] = new_entry
481+ print (f"[INFO] Updated existing changelog entry for { normalized_path } v{ new_entry ['version' ]} " )
482+ break
483+ else :
484+ # Prepend new entry (most recent first)
485+ existing_changelogs [normalized_path ].insert (0 , new_entry )
475486
476487 # Keep only last 20 entries per file (limit history size)
477488 existing_changelogs [normalized_path ] = existing_changelogs [normalized_path ][:20 ]
You can’t perform that action at this time.
0 commit comments