add some delete examples

This commit is contained in:
James
2019-09-05 17:33:13 +01:00
parent 24d5c44f3c
commit 32c31161ae
3 changed files with 76 additions and 0 deletions

22
src/delete_nags.php Executable file
View File

@@ -0,0 +1,22 @@
#!/bin/php
<?php
/*****************************************************
* This will process all issues that match "NAG!":
* 1. Delete any comments that body exactly match "NAG!"
******************************************************/
// load the config, create the connection and load the repo sepcified on the cmd line args
// we will then have $client and $repo available
require('setup.php');
//callback function to process the issues
$tmp=function($issue) use ($repo){
foreach($issue->getComments() as $comment){
if($comment->body=='NAG!'){
$repo->deleteComment($comment);
}
}
};
//do the search and process the results
$repo->forIssues($tmp,['q'=>'NAG!']);