refactor! v1.1
This commit is contained in:
@@ -5,6 +5,8 @@
|
||||
//2b. Also removes the label if present on an issue with a label (excluding the no-label and no-milestone)
|
||||
|
||||
require("src/Client.php");
|
||||
require("src/GiteaData.php");
|
||||
require("src/GiteaRepoData.php");
|
||||
require("src/Issue.php");
|
||||
require("src/Label.php");
|
||||
require("src/Repo.php");
|
||||
@@ -30,7 +32,7 @@ if(!$nomilestoneLabel) die ("Can't find 'no-milestone' label in repo\n");
|
||||
//define the function to process each issue
|
||||
$callback=function($issue) use ($nolabelLabel,$nomilestoneLabel){
|
||||
// do the no-label thing
|
||||
$labelCount=count($issue->getData()->labels);
|
||||
$labelCount=count($issue->labels);
|
||||
if($issue->hasLabel($nolabelLabel)) $labelCount--; //dont count the no-label label
|
||||
if($nomilestoneLabel && $issue->hasLabel($nomilestoneLabel)) $labelCount--; //dont count the no-milestone label
|
||||
if($labelCount==0 && !$issue->hasLabel($nolabelLabel) ){
|
||||
@@ -39,9 +41,9 @@ $callback=function($issue) use ($nolabelLabel,$nomilestoneLabel){
|
||||
$issue->removeLabel( $nolabelLabel );
|
||||
}
|
||||
//do the no-milestone thing
|
||||
if( !$issue->getData()->milestone && !$issue->hasLabel($nomilestoneLabel) ){
|
||||
if( !$issue->milestone && !$issue->hasLabel($nomilestoneLabel) ){
|
||||
$issue->addLabel( $nomilestoneLabel );
|
||||
}elseif( $issue->getData()->milestone && $issue->hasLabel($nomilestoneLabel) ){
|
||||
}elseif( $issue->milestone && $issue->hasLabel($nomilestoneLabel) ){
|
||||
$issue->removeLabel( $nomilestoneLabel );
|
||||
}
|
||||
};
|
||||
|
Reference in New Issue
Block a user