Skip to content

Commit 4c2357a

Browse files
committed
Fixing a bug thanks to Bernhard
1 parent 65ca7ab commit 4c2357a

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

src/AppBundle/GitHub/IssueStatusChanger.php

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ public function setIssueStatusLabel($issueNumber, $newStatus)
3636
);
3737

3838
$labelMap = StatusManager::getLabelToStatusMap();
39+
$addLabel = true;
3940
foreach ($currentLabels as $currentLabelData) {
4041
// get the name of the label
4142
$currentLabel = $currentLabelData['name'];
@@ -47,7 +48,9 @@ public function setIssueStatusLabel($issueNumber, $newStatus)
4748

4849
// if the label is already the new label, we don't need to do anything!
4950
if ($currentLabel == $newLabel) {
50-
return;
51+
// we will *not* need to add the label later on
52+
$addLabel = false;
53+
continue;
5154
}
5255

5356
// remove the old status label
@@ -59,13 +62,15 @@ public function setIssueStatusLabel($issueNumber, $newStatus)
5962
);
6063
}
6164

62-
// add the new label
63-
$this->getIssueLabelsApi()->add(
64-
$this->repositoryUsername,
65-
$this->repositoryName,
66-
$issueNumber,
67-
$newLabel
68-
);
65+
if ($addLabel) {
66+
// add the new label
67+
$this->getIssueLabelsApi()->add(
68+
$this->repositoryUsername,
69+
$this->repositoryName,
70+
$issueNumber,
71+
$newLabel
72+
);
73+
}
6974
}
7075

7176
/**

0 commit comments

Comments
 (0)