enable nagging and tidy a bit

This commit is contained in:
James 2019-08-29 11:00:54 +01:00
parent e422b28a34
commit 6cdf7f293e

View File

@ -12,16 +12,18 @@ $terms=[
]; ];
/* create the labels */ /* create the labels */
/* foreach($terms as $group=>$names){
foreach($terms as $k=>$vs){ foreach($names as $name){
foreach($vs as $v){ $label=$repo->getLabelByName($name);
$label=$repo->getLabelByName($v);
if(!$label){ if(!$label){
$label=$repo->createLabel(['name'=>$new_name,'color'=>'#ffff00','description'=>'Reopen this issue with the given frequency']); $label=$repo->createLabel([
'name'=>$name,
'color'=>'#ffff00',
'description'=>'Reopen this issue with the given frequency'
]);
} }
} }
} }
*/
//define the function to process each issue //define the function to process each issue
@ -50,6 +52,16 @@ $monthly=function($issue) use ($terms){
//print_r(getRepeatTerms($issue,$terms)); //print_r(getRepeatTerms($issue,$terms));
//die(); //die();
if($month_closed!=$month_today){ if($month_closed!=$month_today){
if($issue->state=="closed"){
$issue->state='open';
$issue->save();
}else{
$day_updated=date('z',strtotime($issue->updated_at));
$day_today=date('z');
if($day_updated!=$day_today){
$issue->addComment("NAG!");
}
}
$issue->state='open'; $issue->state='open';
$issue->save(); $issue->save();
} }
@ -97,8 +109,14 @@ function getRepeatTerms($issue,$terms){
$day_name=strtolower(date('l')); $day_name=strtolower(date('l'));
$month_name=strtolower(date('F')); $month_name=strtolower(date('F'));
//$repo->forIssues($daily,['state'=>'open','labels'=>'daily/repeat']); // nag about open issues
//die(); $repo->forIssues($weekly,['labels'=>'weekly/repeat']);
$repo->forIssues($daily,['labels'=>'daily/repeat']);
$repo->forIssues($daily,['labels'=>$day_name.'/repeat']);
$repo->forIssues($monthly,['labels'=>'monthly/repeat']);
$repo->forIssues($monthly,['labels'=>$month_name.'/repeat']);
// reopen closed issues
$repo->forIssues($weekly,['state'=>'closed','labels'=>'weekly/repeat']); $repo->forIssues($weekly,['state'=>'closed','labels'=>'weekly/repeat']);
$repo->forIssues($daily,['state'=>'closed','labels'=>'daily/repeat']); $repo->forIssues($daily,['state'=>'closed','labels'=>'daily/repeat']);
$repo->forIssues($daily,['state'=>'closed','labels'=>$day_name.'/repeat']); $repo->forIssues($daily,['state'=>'closed','labels'=>$day_name.'/repeat']);