[debug]\n"); } $debug = ($argc==4 && $argv[3]=='debug'); //open connection and repo $client=new Client($config['url'],$config['user'],$config['pass'],$debug); $repo=$client->getRepo($argv[1],$argv[2]); $terms=[ 'months'=>['janurary','feburary','march','april','may','june','july','august','september','october','november','december'], 'days'=>['monday','tuesday','wednesday','thursday','friday','saturday','sunday'], 'generic'=>['daily','weekly','fortnightly','monthly','yearly'] ]; /* create the labels */ /* foreach($terms as $k=>$vs){ foreach($vs as $v){ $label=$repo->getLabelByName($v); if(!$label){ $label=$repo->createLabel(['name'=>$new_name,'color'=>'#ffff00','description'=>'Reopen this issue with the given frequency']); } } } */ //define the function to process each issue $daily=function($issue){ //$hours_ago=(time()-strtotime($issue->closed_at))/60/60; $day_closed=date('z',strtotime($issue->closed_at)); $day_today=date('z'); echo $issue->title." ".$issue->closed_at." ($day_closed, $day_today) \n"; if($day_closed!=$day_today){ $issue->state='open'; $issue->save(); } }; //loop through issues and call the callback $repo->forIssues($daily,['state'=>'closed','labels'=>'daily/repeat']);