From 96ef72c71c735c954905a22b82376d56d6fa57f8 Mon Sep 17 00:00:00 2001 From: James Date: Sun, 3 May 2020 09:18:42 +0100 Subject: [PATCH] bug: null error on new issue --- src/PostFailedTests.php | 39 ++++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-) 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})");