@@ -31,9 +31,9 @@ function allIncluded(outputTarget = 'email') {
31
31
let pr_open_button =
32
32
'<div style="vertical-align:middle;display: inline-block;padding: 0px 4px;font-size:9px;font-weight: 600;color: #fff;text-align: center;background-color: #2cbe4e;border-radius: 3px;line-height: 12px;margin-bottom: 2px;" class="State State--green">open</div>' ;
33
33
let pr_closed_button =
34
- '<div style="vertical-align:middle;display: inline-block;padding: 0px 4px;font-size:9px;font-weight: 600;color: #fff;text-align: center;background-color: #d73a49 ;border-radius: 3px;line-height: 12px;margin-bottom: 2px;" class="State State--red ">closed</div>' ;
34
+ '<div style="vertical-align:middle;display: inline-block;padding: 0px 4px;font-size:9px;font-weight: 600;color: #fff;text-align: center;background-color: #6f42c1 ;border-radius: 3px;line-height: 12px;margin-bottom: 2px;" class="State State--purple ">closed</div>' ;
35
35
let pr_merged_button =
36
- '<div style="vertical-align:middle;display: inline-block;padding: 0px 4px;font-size:9px;font-weight: 600;color: #fff;text-align: center;background-color: #6f42c1 ;border-radius: 3px;line-height: 12px;margin-bottom: 2px;" class="State State--purple ">merged</div>' ;
36
+ '<div style="vertical-align:middle;display: inline-block;padding: 0px 4px;font-size:9px;font-weight: 600;color: #fff;text-align: center;background-color: #ff6b6b ;border-radius: 3px;line-height: 12px;margin-bottom: 2px;" class="State State--red ">merged</div>' ;
37
37
38
38
let issue_closed_button =
39
39
'<div style="vertical-align:middle;display: inline-block;padding: 0px 4px;font-size:9px;font-weight: 600;color: #fff;text-align: center;background-color: #6f42c1;border-radius: 3px;line-height: 12px;margin-bottom: 2px;" class="State State--purple">closed</div>' ;
@@ -124,11 +124,6 @@ function allIncluded(outputTarget = 'email') {
124
124
pr_open_button = '' ;
125
125
issue_opened_button = '' ;
126
126
}
127
- if ( ! items . showClosedLabel ) {
128
- showClosedLabel = false ;
129
- pr_closed_button = '' ;
130
-
131
- }
132
127
if ( items . userReason ) {
133
128
userReason = items . userReason ;
134
129
}
@@ -710,7 +705,7 @@ ${userReason}`;
710
705
return Math . ceil ( ( d2 - d1 ) / ( 1000 * 60 * 60 * 24 ) ) ;
711
706
}
712
707
713
- // Session cache for merged status
708
+ // Session cache object
714
709
let sessionMergedStatusCache = { } ;
715
710
716
711
// Helper to fetch PR details for merged status (REST, single PR)
@@ -794,57 +789,55 @@ ${userReason}`;
794
789
if ( item . state === 'open' ) {
795
790
li = `<li><i>(${ project } )</i> - Made PR (#${ number } ) - <a href='${ html_url } '>${ title } </a> ${ pr_open_button } </li>` ;
796
791
} else if ( item . state === 'closed' ) {
792
+ let merged = null ;
797
793
if ( ( githubToken || ( useMergedStatus && ! fallbackToSimple ) ) && mergedStatusResults ) {
798
- let repository_url = item . repository_url ;
799
794
let repoParts = repository_url . split ( '/' ) ;
800
795
let owner = repoParts [ repoParts . length - 2 ] ;
801
796
let repo = repoParts [ repoParts . length - 1 ] ;
802
- let merged = mergedStatusResults [ `${ owner } /${ repo } #${ number } ` ] ;
803
- if ( merged === true ) {
804
- li = `<li><i>(${ project } )</i> - Made PR (#${ number } ) - <a href='${ html_url } '>${ title } </a> ${ pr_merged_button } </li>` ;
805
- } else if ( merged === false ) {
806
- li = `<li><i>(${ project } )</i> - Made PR (#${ number } ) - <a href='${ html_url } '>${ title } </a> ${ pr_closed_button } </li>` ;
807
- } else {
808
- li = `<li><i>(${ project } )</i> - Made PR (#${ number } ) - <a href='${ html_url } '>${ title } </a> ${ pr_closed_button } </li>` ;
809
- }
797
+ merged = mergedStatusResults [ `${ owner } /${ repo } #${ number } ` ] ;
798
+ }
799
+ if ( merged === true ) {
800
+ li = `<li><i>(${ project } )</i> - Made PR (#${ number } ) - <a href='${ html_url } '>${ title } </a> ${ pr_merged_button } </li>` ;
810
801
} else {
802
+ // Always show closed label for merged === false or merged === null/undefined
811
803
li = `<li><i>(${ project } )</i> - Made PR (#${ number } ) - <a href='${ html_url } '>${ title } </a> ${ pr_closed_button } </li>` ;
812
804
}
813
805
}
806
+ lastWeekArray . push ( li ) ;
807
+ continue ; // Prevent issue logic from overwriting PR li
808
+ }
809
+ // Only process as issue if not a PR
810
+ if ( item . state === 'open' && item . body ?. toUpperCase ( ) . indexOf ( 'YES' ) > 0 ) {
811
+ let li2 =
812
+ '<li><i>(' +
813
+ project +
814
+ ')</i> - Work on Issue(#' +
815
+ number +
816
+ ") - <a href='" +
817
+ html_url +
818
+ "' target='_blank'>" +
819
+ title +
820
+ '</a> ' +
821
+ issue_opened_button +
822
+ ' </li>' ;
823
+ nextWeekArray . push ( li2 ) ;
824
+ }
825
+ if ( item . state === 'open' ) {
826
+ li = `<li><i>(${ project } )</i> - Opened Issue(#${ number } ) - <a href='${ html_url } '>${ title } </a> ${ issue_opened_button } </li>` ;
827
+ } else if ( item . state === 'closed' ) {
828
+ // Always show closed label for closed issues
829
+ li = `<li><i>(${ project } )</i> - Opened Issue(#${ number } ) - <a href='${ html_url } '>${ title } </a> ${ issue_closed_button } </li>` ;
814
830
} else {
815
- // is a issue
816
- if ( item . state === 'open' && item . body ?. toUpperCase ( ) . indexOf ( 'YES' ) > 0 ) {
817
- let li2 =
818
- '<li><i>(' +
819
- project +
820
- ')</i> - Work on Issue(#' +
821
- number +
822
- ") - <a href='" +
823
- html_url +
824
- "' target='_blank'>" +
825
- title +
826
- '</a> ' +
827
- issue_opened_button +
828
- ' </li>' ;
829
- nextWeekArray . push ( li2 ) ;
830
- }
831
- if ( item . state === 'open' ) {
832
- li = `<li><i>(${ project } )</i> - Opened Issue(#${ number } ) - <a href='${ html_url } '>${ title } </a> ${ issue_opened_button } </li>` ;
833
- } else if ( item . state === 'closed' ) {
834
- // Always show closed label for closed issues
835
- li = `<li><i>(${ project } )</i> - Opened Issue(#${ number } ) - <a href='${ html_url } '>${ title } </a> ${ issue_closed_button } </li>` ;
836
- } else {
837
- li =
838
- '<li><i>(' +
839
- project +
840
- ')</i> - Opened Issue(#' +
841
- number +
842
- ") - <a href='" +
843
- html_url +
844
- "' target='_blank'>" +
845
- title +
846
- '</a> </li>' ;
847
- }
831
+ li =
832
+ '<li><i>(' +
833
+ project +
834
+ ')</i> - Opened Issue(#' +
835
+ number +
836
+ ") - <a href='" +
837
+ html_url +
838
+ "' target='_blank'>" +
839
+ title +
840
+ '</a> </li>' ;
848
841
}
849
842
lastWeekArray . push ( li ) ;
850
843
}
@@ -1039,57 +1032,55 @@ async function writeGithubIssuesPrs() {
1039
1032
if ( item . state === 'open' ) {
1040
1033
li = `<li><i>(${ project } )</i> - Made PR (#${ number } ) - <a href='${ html_url } '>${ title } </a> ${ pr_open_button } </li>` ;
1041
1034
} else if ( item . state === 'closed' ) {
1042
- if ( useMergedStatus && ! fallbackToSimple && githubToken ) {
1043
- let repository_url = item . repository_url ;
1035
+ let merged = null ;
1036
+ if ( ( githubToken || ( useMergedStatus && ! fallbackToSimple ) ) && mergedStatusResults ) {
1044
1037
let repoParts = repository_url . split ( '/' ) ;
1045
1038
let owner = repoParts [ repoParts . length - 2 ] ;
1046
1039
let repo = repoParts [ repoParts . length - 1 ] ;
1047
- let merged = mergedStatusResults [ `${ owner } /${ repo } #${ number } ` ] ;
1048
- if ( merged === true ) {
1049
- li = `<li><i>(${ project } )</i> - Made PR (#${ number } ) - <a href='${ html_url } '>${ title } </a> ${ pr_merged_button } </li>` ;
1050
- } else if ( merged === false ) {
1051
- li = `<li><i>(${ project } )</i> - Made PR (#${ number } ) - <a href='${ html_url } '>${ title } </a> ${ pr_closed_button } </li>` ;
1052
- } else {
1053
- li = `<li><i>(${ project } )</i> - Made PR (#${ number } ) - <a href='${ html_url } '>${ title } </a> ${ pr_closed_button } </li>` ;
1054
- }
1040
+ merged = mergedStatusResults [ `${ owner } /${ repo } #${ number } ` ] ;
1041
+ }
1042
+ if ( merged === true ) {
1043
+ li = `<li><i>(${ project } )</i> - Made PR (#${ number } ) - <a href='${ html_url } '>${ title } </a> ${ pr_merged_button } </li>` ;
1055
1044
} else {
1045
+ // Always show closed label for merged === false or merged === null/undefined
1056
1046
li = `<li><i>(${ project } )</i> - Made PR (#${ number } ) - <a href='${ html_url } '>${ title } </a> ${ pr_closed_button } </li>` ;
1057
1047
}
1058
1048
}
1049
+ lastWeekArray . push ( li ) ;
1050
+ continue ; // Prevent issue logic from overwriting PR li
1051
+ }
1052
+ // Only process as issue if not a PR
1053
+ if ( item . state === 'open' && item . body ?. toUpperCase ( ) . indexOf ( 'YES' ) > 0 ) {
1054
+ let li2 =
1055
+ '<li><i>(' +
1056
+ project +
1057
+ ')</i> - Work on Issue(#' +
1058
+ number +
1059
+ ") - <a href='" +
1060
+ html_url +
1061
+ "' target='_blank'>" +
1062
+ title +
1063
+ '</a> ' +
1064
+ issue_opened_button +
1065
+ ' </li>' ;
1066
+ nextWeekArray . push ( li2 ) ;
1067
+ }
1068
+ if ( item . state === 'open' ) {
1069
+ li = `<li><i>(${ project } )</i> - Opened Issue(#${ number } ) - <a href='${ html_url } '>${ title } </a> ${ issue_opened_button } </li>` ;
1070
+ } else if ( item . state === 'closed' ) {
1071
+ // Always show closed label for closed issues
1072
+ li = `<li><i>(${ project } )</i> - Opened Issue(#${ number } ) - <a href='${ html_url } '>${ title } </a> ${ issue_closed_button } </li>` ;
1059
1073
} else {
1060
- // is a issue
1061
- if ( item . state === 'open' && item . body ?. toUpperCase ( ) . indexOf ( 'YES' ) > 0 ) {
1062
- let li2 =
1063
- '<li><i>(' +
1064
- project +
1065
- ')</i> - Work on Issue(#' +
1066
- number +
1067
- ") - <a href='" +
1068
- html_url +
1069
- "' target='_blank'>" +
1070
- title +
1071
- '</a> ' +
1072
- issue_opened_button +
1073
- ' </li>' ;
1074
- nextWeekArray . push ( li2 ) ;
1075
- }
1076
- if ( item . state === 'open' ) {
1077
- li = `<li><i>(${ project } )</i> - Opened Issue(#${ number } ) - <a href='${ html_url } '>${ title } </a> ${ issue_opened_button } </li>` ;
1078
- } else if ( item . state === 'closed' ) {
1079
- // Always show closed label for closed issues
1080
- li = `<li><i>(${ project } )</i> - Opened Issue(#${ number } ) - <a href='${ html_url } '>${ title } </a> ${ issue_closed_button } </li>` ;
1081
- } else {
1082
- li =
1083
- '<li><i>(' +
1084
- project +
1085
- ')</i> - Opened Issue(#' +
1086
- number +
1087
- ") - <a href='" +
1088
- html_url +
1089
- "' target='_blank'>" +
1090
- title +
1091
- '</a> </li>' ;
1092
- }
1074
+ li =
1075
+ '<li><i>(' +
1076
+ project +
1077
+ ')</i> - Opened Issue(#' +
1078
+ number +
1079
+ ") - <a href='" +
1080
+ html_url +
1081
+ "' target='_blank'>" +
1082
+ title +
1083
+ '</a> </li>' ;
1093
1084
}
1094
1085
lastWeekArray . push ( li ) ;
1095
1086
}
@@ -1115,4 +1106,4 @@ let intervalWriteGithubIssues = setInterval(async () => {
1115
1106
logError ( 'Interval writeGithubIssuesPrs error:' , err ) ;
1116
1107
}
1117
1108
} , 500 ) ;
1118
- // ... existing code ...
1109
+ // ... existing code ...
0 commit comments