From c309f2b225f70fda944147b6367594314954f205 Mon Sep 17 00:00:00 2001 From: James Date: Sat, 4 Apr 2020 11:10:29 +0100 Subject: [PATCH] add "@bot quiet" to suppress repeat warnings --- src/PostFailedTests.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/PostFailedTests.php b/src/PostFailedTests.php index 68a773c..d27baa7 100644 --- a/src/PostFailedTests.php +++ b/src/PostFailedTests.php @@ -69,14 +69,24 @@ final class PostFailedTests{ // get any existing issue $issue=$this->repo->getIssues(['q' => $name])[0]??null; + // are there any instructions in comments? + $quiet=false; + foreach($issue->getComments() as $comment){ + if( stripos('@bot quiet',$comment->body)!==false ){ + $quiet=true; + } + } + // if existing issue, is the error the same? if($issue){ if( $this->doesMessageMatch($issue->body,$message,$att) ){ + if($quiet){return;} $issue->addComment("Failed again. Same errors as [above]($issue->html_url#issue-{$issue->id})"); return; }else{ foreach($issue->getComments() as $comment){ if( $this->doesMessageMatch($comment->body,$message,$att) ){ + if($quiet){return;} $issue->addComment("Failed again. Same errors as [above]($issue->html_url#issuecomment-{$comment->id})"); return; }