@@ -48,6 +48,7 @@ async function getTeam(repository, prNumber) {
4848
4949 // Step 4: Return the team name or 'Unknown' if not found
5050 return team || 'Unknown' ;
51+
5152 } catch ( error ) {
5253 console . error (
5354 `Error fetching team for PR #${ prNumber } :` ,
@@ -59,6 +60,8 @@ async function getTeam(repository, prNumber) {
5960
6061// Function to filter commits based on unique commit messages and group by teams
6162async function filterCommitsByTeam ( platform , branchA , branchB ) {
63+
64+ const MAX_COMMITS = 500 ; // Limit the number of commits to process
6265 console . log ( 'Filtering commits by team...' ) ;
6366
6467 var repository = '' ;
@@ -89,9 +92,13 @@ async function filterCommitsByTeam(platform, branchA, branchB) {
8992 } ;
9093
9194 const log = await git . log ( logOptions ) ;
95+
96+ console . log ( `Total commits between ${ branchA } and ${ branchB } : ${ log . total } ` ) ;
97+ console . log ( `Processing up to ${ Math . min ( log . all . length , MAX_COMMITS ) } commits...` ) ;
98+
9299 const commitsByTeam = { } ;
93100
94- const MAX_COMMITS = 500 ; // Limit the number of commits to process
101+
95102
96103 for ( const commit of log . all ) {
97104 const { author, message, hash } = commit ;
@@ -121,7 +128,15 @@ async function filterCommitsByTeam(platform, branchA, branchB) {
121128 } ) ;
122129 }
123130 }
131+
132+ // Count total processed commits after the loop
133+ const totalProcessed = Object . values ( commitsByTeam )
134+ . reduce ( ( sum , commits ) => sum + commits . length , 0 ) ;
135+
136+ console . log ( `Total commits eligible for commits.csv : ${ totalProcessed } ` ) ;
137+
124138 return commitsByTeam ;
139+
125140 } catch ( error ) {
126141 console . error ( error ) ;
127142 return { } ;
0 commit comments