@@ -444,7 +444,6 @@ function allIncluded(outputTarget = 'email') {
444444 // Attach commits to PR objects
445445 openPRs . forEach ( pr => {
446446 pr . _allCommits = commitMap [ pr . number ] || [ ] ;
447- pr . _lastCommits = pr . _allCommits ;
448447 } ) ;
449448 }
450449 }
@@ -934,12 +933,27 @@ ${userReason}`;
934933 }
935934
936935 if ( item . pull_request ) {
936+
937+ const prCreatedDate = new Date ( item . created_at ) ;
938+ const startDate = new Date ( startingDate ) ;
939+ const endDate = new Date ( endingDate + 'T23:59:59' ) ;
940+ const isNewPR = prCreatedDate >= startDate && prCreatedDate <= endDate ;
941+
942+ if ( ! isNewPR ) {
943+ const hasCommitsInRange = showCommits && item . _allCommits && item . _allCommits . length > 0 ;
944+ if ( ! hasCommitsInRange ) {
945+ continue ; //skip these prs - created outside daterange with no commits
946+ }
947+ }
948+
949+ const prAction = isNewPR ? 'Made PR' : 'Existing PR' ;
950+
937951 if ( isDraft ) {
938- li = `<li><i>(${ project } )</i> - Made PR (#${ number } ) - <a href='${ html_url } '>${ title } </a> ${ pr_draft_button } </li>` ;
952+ li = `<li><i>(${ project } )</i> - ${ prAction } (#${ number } ) - <a href='${ html_url } '>${ title } </a> ${ pr_draft_button } </li>` ;
939953 } else if ( item . state === 'open' ) {
940- li = `<li><i>(${ project } )</i> - Made PR (#${ number } ) - <a href='${ html_url } '>${ title } </a> ${ pr_open_button } ` ;
941- if ( showCommits && item . _lastCommits && item . _lastCommits . length ) {
942- item . _lastCommits . forEach ( commit => {
954+ li = `<li><i>(${ project } )</i> - ${ prAction } (#${ number } ) - <a href='${ html_url } '>${ title } </a> ${ pr_open_button } ` ;
955+ if ( showCommits && item . _allCommits && item . _allCommits . length ) {
956+ item . _allCommits . forEach ( commit => {
943957 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>` ;
944958 } ) ;
945959 }
@@ -960,7 +974,7 @@ ${userReason}`;
960974 }
961975 }
962976 lastWeekArray . push ( li ) ;
963- continue ; // Prevent issue logic from overwriting PR li
977+ continue ;
964978 } else {
965979 // is a issue
966980 if ( item . state === 'open' && item . body ?. toUpperCase ( ) . indexOf ( 'YES' ) > 0 ) {
0 commit comments