diff --git a/src/due.php b/src/due.php deleted file mode 100644 index c365671..0000000 --- a/src/due.php +++ /dev/null @@ -1,55 +0,0 @@ -#!/usr/bin/php -'today','this week'=>'this week','this month'=>'this month']; - -/* load or create the labels */ -foreach($labels as $k=>$v){ - $label=$repo->getLabelByName($v); - if(!$label){ - $label=$repo->createLabel([ - 'name'=>$v, - 'color'=>'#00ffff', - 'description'=>'Due $v' - ]); - } - $labels[$k]=$label; -} - -// we are processing ALL issues, and not changing the state -// (see https://git.jhodges.co.uk/jhodges/GiteaBot/issues/1) -// so we can use forIssues() here to keep memory usage down -$repo->forIssues(function($issue) use ($labels) { - if($issue->due_date){ - $day_today=date('U')/60/60/24; - $days_until_due=(date('U',strtotime($issue->due_date))/60/60/24)-$day_today; - echo "$issue->title : $days_until_due \n"; - if($days_until_due<0){ - $issue->addComment("NAG!"); - } - if($days_until_due<1){ - if(!$issue->hasLabel($labels['today'])){ - $issue->addLabel($labels['today']); - } - } - if($days_until_due<7){ - if(!$issue->hasLabel($labels['this week'])){ - $issue->addLabel($labels['this week']); - } - } - if($days_until_due<30){ - if(!$issue->hasLabel($labels['this month'])){ - $issue->addLabel($labels['this month']); - } - } - } -});