@@ -396,7 +396,7 @@ function allIncluded(outputTarget = 'email') {
396396 log ( 'Making public requests' ) ;
397397 }
398398
399- let issueUrl = `https://api.github.com/search/issues?q=author%3A${ githubUsername } +org%3A${ orgName } +created %3A${ startingDate } ..${ endingDate } &per_page=100` ;
399+ let issueUrl = `https://api.github.com/search/issues?q=author%3A${ githubUsername } +org%3A${ orgName } +updated %3A${ startingDate } ..${ endingDate } &per_page=100` ;
400400 let prUrl = `https://api.github.com/search/issues?q=commenter%3A${ githubUsername } +org%3A${ orgName } +updated%3A${ startingDate } ..${ endingDate } &per_page=100` ;
401401 let userUrl = `https://api.github.com/users/${ githubUsername } ` ;
402402
@@ -432,16 +432,20 @@ function allIncluded(outputTarget = 'email') {
432432 githubUserData = await userRes . json ( ) ;
433433
434434 if ( githubIssuesData && githubIssuesData . items ) {
435+ log ( 'Fetched githubIssuesData:' , githubIssuesData . items . length , 'items' ) ;
435436 // Collect open PRs
436437 const openPRs = githubIssuesData . items . filter (
437438 item => item . pull_request && item . state === 'open'
438439 ) ;
440+ log ( 'Open PRs for commit fetching:' , openPRs . map ( pr => pr . number ) ) ;
439441 // Fetch commits for open PRs (batch)
440442 if ( openPRs . length && githubToken ) {
441443 const commitMap = await fetchCommitsForOpenPRs ( openPRs , githubToken , startingDate , endingDate ) ;
444+ log ( 'Commit map returned from fetchCommitsForOpenPRs:' , commitMap ) ;
442445 // Attach commits to PR objects
443446 openPRs . forEach ( pr => {
444447 pr . _allCommits = commitMap [ pr . number ] || [ ] ;
448+ log ( `Attached ${ pr . _allCommits . length } commits to PR #${ pr . number } ` ) ;
445449 } ) ;
446450 }
447451 }
@@ -489,6 +493,7 @@ function allIncluded(outputTarget = 'email') {
489493 }
490494
491495 async function fetchCommitsForOpenPRs ( prs , githubToken , startDate , endDate ) {
496+ log ( 'fetchCommitsForOpenPRs called with PRs:' , prs . map ( pr => pr . number ) , 'startDate:' , startDate , 'endDate:' , endDate ) ;
492497 if ( ! prs . length ) return { } ;
493498 const since = new Date ( startDate ) . toISOString ( ) ;
494499 const until = new Date ( endDate + 'T23:59:59' ) . toISOString ( ) ;
@@ -514,11 +519,10 @@ function allIncluded(outputTarget = 'email') {
514519 }
515520 }
516521
517- }
518- ` ;
522+ }` ;
519523 } ) . join ( '\n' ) ;
520524 const query = `query { ${ queries } }` ;
521-
525+ log ( 'GraphQL query for commits:' , query ) ;
522526 const res = await fetch ( 'https://api.github.com/graphql' , {
523527 method : 'POST' ,
524528 headers : {
@@ -527,19 +531,25 @@ function allIncluded(outputTarget = 'email') {
527531 } ,
528532 body : JSON . stringify ( { query } )
529533 } ) ;
534+ log ( 'fetchCommitsForOpenPRs response status:' , res . status ) ;
530535 const data = await res . json ( ) ;
536+ log ( 'fetchCommitsForOpenPRs response data:' , data ) ;
531537 let commitMap = { } ;
532538 prs . forEach ( ( pr , idx ) => {
533539 const prData = data . data && data . data [ `pr${ idx } ` ] && data . data [ `pr${ idx } ` ] . pullRequest ;
534540 if ( prData && prData . commits && prData . commits . nodes ) {
535541 const allCommits = prData . commits . nodes . map ( n => n . commit ) ;
542+ log ( `PR #${ pr . number } allCommits:` , allCommits ) ;
536543 const filteredCommits = allCommits . filter ( commit => {
537544 const commitDate = new Date ( commit . committedDate ) ;
538545 const sinceDate = new Date ( since ) ;
539546 const untilDate = new Date ( until ) ;
540547 return commitDate >= sinceDate && commitDate <= untilDate ;
541548 } ) ;
549+ log ( `PR #${ pr . number } filteredCommits:` , filteredCommits ) ;
542550 commitMap [ pr . number ] = filteredCommits ;
551+ } else {
552+ log ( `No commits found for PR #${ pr . number } ` ) ;
543553 }
544554 } ) ;
545555 return commitMap ;
@@ -593,6 +603,7 @@ function allIncluded(outputTarget = 'email') {
593603 user : githubUserData ?. login
594604 } ) ;
595605
606+
596607 lastWeekArray = [ ] ;
597608 nextWeekArray = [ ] ;
598609 reviewedPrsArray = [ ] ;
@@ -863,6 +874,7 @@ ${userReason}`;
863874 }
864875
865876 async function writeGithubIssuesPrs ( ) {
877+ log ( 'writeGithubIssuesPrs called' ) ;
866878 let items = githubIssuesData . items ;
867879 lastWeekArray = [ ] ;
868880 nextWeekArray = [ ] ;
@@ -882,7 +894,6 @@ ${userReason}`;
882894 } else if ( daysRange <= 7 ) {
883895 useMergedStatus = true ;
884896 }
885-
886897 // Collect PRs to batch fetch merged status
887898 let prsToCheck = [ ] ;
888899 for ( let i = 0 ; i < items . length ; i ++ ) {
@@ -901,6 +912,7 @@ ${userReason}`;
901912 // Use GraphQL batching for all cases
902913 if ( prsToCheck . length > 0 ) {
903914 mergedStatusResults = await fetchPrsMergedStatusBatch ( prsToCheck , headers ) ;
915+ log ( 'Merged status results (GraphQL):' , mergedStatusResults ) ;
904916 }
905917 } else if ( useMergedStatus ) {
906918 if ( prsToCheck . length > 30 ) {
@@ -914,9 +926,9 @@ ${userReason}`;
914926 let merged = await fetchPrMergedStatusREST ( pr . owner , pr . repo , pr . number , headers ) ;
915927 mergedStatusResults [ `${ pr . owner } /${ pr . repo } #${ pr . number } ` ] = merged ;
916928 }
929+ log ( 'Merged status results (REST):' , mergedStatusResults ) ;
917930 }
918931 }
919-
920932 for ( let i = 0 ; i < items . length ; i ++ ) {
921933 let item = items [ i ] ;
922934 let html_url = item . html_url ;
@@ -925,12 +937,10 @@ ${userReason}`;
925937 let title = item . title ;
926938 let number = item . number ;
927939 let li = '' ;
928-
929940 let isDraft = false ;
930941 if ( item . pull_request && typeof item . draft !== 'undefined' ) {
931942 isDraft = item . draft ;
932943 }
933-
934944 if ( item . pull_request ) {
935945
936946 const prCreatedDate = new Date ( item . created_at ) ;
@@ -940,20 +950,25 @@ ${userReason}`;
940950
941951 if ( ! isNewPR ) {
942952 const hasCommitsInRange = showCommits && item . _allCommits && item . _allCommits . length > 0 ;
953+
943954 if ( ! hasCommitsInRange ) {
955+
944956 continue ; //skip these prs - created outside daterange with no commits
957+ } else {
958+
945959 }
946- }
960+ } else {
947961
962+ }
948963 const prAction = isNewPR ? 'Made PR' : 'Existing PR' ;
949-
950964 if ( isDraft ) {
951965 li = `<li><i>(${ project } )</i> - ${ prAction } (#${ number } ) - <a href='${ html_url } '>${ title } </a> ${ pr_draft_button } </li>` ;
952966 } else if ( item . state === 'open' ) {
953967 li = `<li><i>(${ project } )</i> - ${ prAction } (#${ number } ) - <a href='${ html_url } '>${ title } </a> ${ pr_open_button } ` ;
954968 if ( showCommits && item . _allCommits && item . _allCommits . length && ! isNewPR ) {
969+ log ( `[PR DEBUG] Rendering commits for existing PR #${ number } :` , item . _allCommits ) ;
955970 item . _allCommits . forEach ( commit => {
956- li += `<li style="list-style: disc; margin: 0 0 0 20px; padding: 0; color: #666;"><span style="color:#2563eb;">${ commit . messageHeadline } </span><span style="color:#666; font-size: 11px;"> (${ new Date ( commit . committedDate ) . toLocaleString ( ) } )</span></li>` ;
971+ li += `<li style=\ "list-style: disc; margin: 0 0 0 20px; padding: 0; color: #666;\ "><span style=\ "color:#2563eb;\ ">${ commit . messageHeadline } </span><span style=\ "color:#666; font-size: 11px;\ "> (${ new Date ( commit . committedDate ) . toLocaleString ( ) } )</span></li>` ;
957972 } ) ;
958973 }
959974 li += `</li>` ;
0 commit comments