diff --git a/repeat.php b/repeat.php index 5fad0e6..6a894c3 100644 --- a/repeat.php +++ b/repeat.php @@ -63,6 +63,23 @@ $monthly=function($issue) use ($terms){ } }; +$weekly=function($issue){ + $day_updated=date('d/m/Y',strtotime($issue->updated_at)); + $day_closed=date('d/m/Y',strtotime($issue->closed_at)); + $day_today=date('d/m/Y'); + echo "Weekly: ". $issue->title." ".$issue->closed_at." ($day_closed, $day_today) \n"; + if( abs($day_closed-$day_today)>7 ){ + if($issue->state=="closed"){ + $issue->state='open'; + $issue->save(); + }else{ + if($day_updated!=$day_today){ + $issue->addComment("NAG!"); + } + } + } +}; + $tmp=function($issue){ //$hours_ago=(time()-strtotime($issue->closed_at))/60/60; }; @@ -90,6 +107,7 @@ $month_name=strtolower(date('F')); //$repo->forIssues($daily,['state'=>'open','labels'=>'daily/repeat']); //die(); +$repo->forIssues($weekly,['state'=>'closed','labels'=>'weekly/repeat']); $repo->forIssues($daily,['state'=>'closed','labels'=>'daily/repeat']); $repo->forIssues($daily,['state'=>'closed','labels'=>$day_name.'/repeat']); $repo->forIssues($monthly,['state'=>'closed','labels'=>'monthly/repeat']);