@@ -30,7 +30,7 @@ module.exports = (app) => {
3030 pr = response . data ;
3131 }
3232
33- let hasOutstandingTasks = checkOutstandingTasks ( pr . body ) ;
33+ let outstandingTasks = checkOutstandingTasks ( pr . body ) ;
3434
3535 // lookup comments on the PR
3636 let comments = await context . github . issues . listComments ( context . repo ( {
@@ -56,9 +56,9 @@ module.exports = (app) => {
5656 // & check them for tasks
5757 if ( comments . data . length ) {
5858 comments . data . forEach ( function ( comment ) {
59- if ( checkOutstandingTasks ( comment . body ) ) {
60- hasOutstandingTasks = true ;
61- }
59+ let commentOutstandingTasks = checkOutstandingTasks ( comment . body ) ;
60+ outstandingTasks . total += commentOutstandingTasks . total ;
61+ outstandingTasks . remaining += commentOutstandingTasks . remaining ;
6262 } ) ;
6363 }
6464
@@ -68,18 +68,18 @@ module.exports = (app) => {
6868 started_at : startTime ,
6969 status : 'in_progress' ,
7070 output : {
71- title : 'Outstanding tasks',
72- summary : 'Tasks still remain to be completed',
71+ title : ( outstandingTasks . total - outstandingTasks . remaining ) + ' / ' + outstandingTasks . total + ' tasks completed ',
72+ summary : outstandingTasks . remaining + ' task' + ( outstandingTasks . remaining > 1 ? 's' : '' ) + ' still to be completed',
7373 text : 'We check if any task lists need completing before you can merge this PR'
7474 }
7575 } ;
7676
7777 // all finished?
78- if ( hasOutstandingTasks === false ) {
78+ console . log ( outstandingTasks ) ;
79+ if ( outstandingTasks . remaining === 0 ) {
7980 check . status = 'completed' ;
8081 check . conclusion = 'success' ;
8182 check . completed_at = ( new Date ) . toISOString ( ) ;
82- check . output . title = 'Tasks completed' ;
8383 check . output . summary = 'All tasks have been completed' ;
8484 } ;
8585
0 commit comments