diff --git a/src/PostFailedTests.php b/src/PostFailedTests.php index 2975977..c483f73 100644 --- a/src/PostFailedTests.php +++ b/src/PostFailedTests.php @@ -69,26 +69,27 @@ final class PostFailedTests{ // get any existing issue $issue=$this->repo->getIssues(['q' => $name])[0]??null; - // are there any instructions in comments? - $quiet=$silent=false; - foreach($issue->getComments() as $comment){ - if( stripos('@bot quiet',$comment->body)!==false ){ - $quiet=true; - $silent=false; - } - if( stripos('@bot silent',$comment->body)!==false ){ - $silent=true; - $quiet=true; - } - if( stripos('@bot normal',$comment->body)!==false ){ - $silent=false; - $quiet=false; - } - } - if($silent){return;} - - // if existing issue, is the error the same? + // if existing issue. if($issue){ + // are there any instructions in comments? + $quiet=$silent=false; + foreach($issue->getComments() as $comment){ + if( stripos('@bot quiet',$comment->body)!==false ){ + $quiet=true; + $silent=false; + } + if( stripos('@bot silent',$comment->body)!==false ){ + $silent=true; + $quiet=true; + } + if( stripos('@bot normal',$comment->body)!==false ){ + $silent=false; + $quiet=false; + } + } + if($silent){return;} + + //is the error the same? if( $this->doesMessageMatch($issue->body,$message,$att) ){ if($quiet){return;} $issue->addComment("Failed again. Same errors as [above]($issue->html_url#issue-{$issue->id})");