@@ -761,32 +761,52 @@ function Get-VersionNotes {
761761
762762 # Try with progressively more relaxed filtering to ensure we show commits
763763
764+ # Get full commit info with hash to ensure uniqueness
765+ $format = ' %h|%s|%aN'
766+
764767 # First try with standard filters
765- $commits = " git log --pretty=format:`" %s ([@%aN](https://github.com/%aN)) `" --perl-regexp --regexp-ignore-case --grep=`" $EXCLUDE_PRS `" --invert-grep --committer=`" $EXCLUDE_BOTS `" --author=`" $EXCLUDE_BOTS `" `" $range `" | Sort-Object | Get-Unique " | Invoke-ExpressionWithLogging
768+ $rawCommits = " git log --pretty=format:`" $format `" --perl-regexp --regexp-ignore-case --grep=`" $EXCLUDE_PRS `" --invert-grep --committer=`" $EXCLUDE_BOTS `" --author=`" $EXCLUDE_BOTS `" `" $range `" " | Invoke-ExpressionWithLogging
766769
767770 # If no commits found, try with just PR exclusion but no author filtering
768- if (($commits | Measure-Object ).Count -eq 0 ) {
771+ if (($rawCommits | Measure-Object ).Count -eq 0 ) {
769772 Write-Information " No commits found with standard filters, trying with relaxed author/committer filters..." - Tags " Get-VersionNotes"
770- $commits = " git log --pretty=format:`" %s ([@%aN](https://github.com/%aN)) `" --perl-regexp --regexp-ignore-case --grep=`" $EXCLUDE_PRS `" --invert-grep `" $range `" | Sort-Object | Get-Unique " | Invoke-ExpressionWithLogging
773+ $rawCommits = " git log --pretty=format:`" $format `" --perl-regexp --regexp-ignore-case --grep=`" $EXCLUDE_PRS `" --invert-grep `" $range `" " | Invoke-ExpressionWithLogging
771774 }
772775
773776 # If still no commits, try with no filtering at all - show everything in the range
774- if (($commits | Measure-Object ).Count -eq 0 ) {
777+ if (($rawCommits | Measure-Object ).Count -eq 0 ) {
775778 Write-Information " Still no commits found, trying with no filters..." - Tags " Get-VersionNotes"
776- $commits = " git log --pretty=format:`" %s ([@%aN](https://github.com/%aN)) `" `" $range `" | Sort-Object | Get-Unique " | Invoke-ExpressionWithLogging
779+ $rawCommits = " git log --pretty=format:`" $format `" `" $range `" " | Invoke-ExpressionWithLogging
777780
778781 # If it's a prerelease version, include also version update commits
779- if ($versionType -eq " prerelease" -and ($commits | Measure-Object ).Count -eq 0 ) {
782+ if ($versionType -eq " prerelease" -and ($rawCommits | Measure-Object ).Count -eq 0 ) {
780783 Write-Information " Looking for version update commits for prerelease..." - Tags " Get-VersionNotes"
781- $commits = " git log --pretty=format:`" %s ([@%aN](https://github.com/%aN))`" --grep=`" Update VERSION to`" `" $range `" | Sort-Object | Get-Unique" | Invoke-ExpressionWithLogging
784+ $rawCommits = " git log --pretty=format:`" $format `" --grep=`" Update VERSION to`" `" $range `" " | Invoke-ExpressionWithLogging
785+ }
786+ }
787+
788+ # Process raw commits into structured format
789+ $structuredCommits = @ ()
790+ foreach ($commit in $rawCommits ) {
791+ $parts = $commit -split ' \|'
792+ if ($parts.Count -ge 3 ) {
793+ $structuredCommits += [PSCustomObject ]@ {
794+ Hash = $parts [0 ]
795+ Subject = $parts [1 ]
796+ Author = $parts [2 ]
797+ FormattedEntry = " $ ( $parts [1 ]) ([@$ ( $parts [2 ]) ](https://github.com/$ ( $parts [2 ]) ))"
798+ }
782799 }
783800 }
784801
785- Write-Information " Found $ ( ($commits | Measure-Object ).Count) commits for $ToTag " - Tags " Get-VersionNotes"
802+ # Get unique commits based on hash (ensures unique commits)
803+ $uniqueCommits = $structuredCommits | Sort-Object - Property Hash - Unique | ForEach-Object { $_.FormattedEntry }
804+
805+ Write-Information " Found $ ( ($uniqueCommits | Measure-Object ).Count) commits for $ToTag " - Tags " Get-VersionNotes"
786806
787807 # Format changelog entry
788808 $versionChangelog = " "
789- if (($commits | Measure-Object ).Count -gt 0 ) {
809+ if (($uniqueCommits | Measure-Object ).Count -gt 0 ) {
790810 $versionChangelog = " ## $ToTag "
791811 if ($versionType -ne " unknown" ) {
792812 $versionChangelog += " ($versionType )"
@@ -799,9 +819,9 @@ function Get-VersionNotes {
799819
800820 # Only filter out version updates for non-prerelease versions
801821 if ($versionType -ne " prerelease" ) {
802- $filteredCommits = $commits | Where-Object { -not $_.Contains (" Update VERSION to" ) -and -not $_.Contains (" [skip ci]" ) }
822+ $filteredCommits = $uniqueCommits | Where-Object { -not $_.Contains (" Update VERSION to" ) -and -not $_.Contains (" [skip ci]" ) }
803823 } else {
804- $filteredCommits = $commits | Where-Object { -not $_.Contains (" [skip ci]" ) }
824+ $filteredCommits = $uniqueCommits | Where-Object { -not $_.Contains (" [skip ci]" ) }
805825 }
806826
807827 foreach ($commit in $filteredCommits ) {
0 commit comments