@@ -40,15 +40,16 @@ async function getTimeInactiveInHours(issue) {
4040 const commentsAry = comments . data . sort ( ( a , b ) => {
4141 return toUnixTimestamp ( b . created_at ) - toUnixTimestamp ( a . created_at ) ;
4242 } ) ;
43- commentsAry . forEach ( comment => {
43+ for ( var i = 0 ; i < commentsAry . length ; i ++ ) {
44+ const comment = commentsAry [ i ] ;
4445 if ( comment . user . login === 'github-actions[bot]' ) {
45- return true ;
46+ continue ;
4647 }
4748 else {
4849 lastUpdated = comment . created_at ;
49- return false ;
50+ break ;
5051 }
51- } ) ;
52+ }
5253
5354 if ( ! lastUpdated ) {
5455 // If we get here, it means there were no comments, or they were all from
@@ -66,14 +67,15 @@ async function getTimeInactiveInHours(issue) {
6667 const eventsAry = events . data . sort ( ( a , b ) => {
6768 return toUnixTimestamp ( b . created_at ) - toUnixTimestamp ( a . created_at ) ;
6869 } ) ;
69- eventsAry . forEach ( event => {
70+ for ( var i = 0 ; i < eventsAry . length ; i ++ ) {
71+ const event = eventsAry [ i ] ;
7072 if ( event . event === 'assigned' ) {
71- if ( ( new Date ( event . created_at ) . getTime ( ) ) > ( new Date ( lastUpdated ) . getTime ( ) ) ) {
73+ if ( toUnixTimestamp ( event . created_at ) > toUnixTimestamp ( lastUpdated ) ) {
7274 lastUpdated = event . created_at ;
7375 }
74- return false ; // Found the latest event, no need to continue
76+ break ; // Found the latest event, no need to continue
7577 }
76- } ) ;
78+ }
7779
7880 // Convert lastUpdated to timeInactiveInHours
7981 var timeInactiveInHours = null ;
0 commit comments