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

27
src/delete_me.php Executable file
View File

@@ -0,0 +1,27 @@
#!/bin/php
<?php
/**************************************************
* this will process all issues titled "delete me":
* 1. remove all labels
* 2. close the issue
* 3. change the title to "deleted"
**************************************************/
// 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){
if($issue->title=='delete me'){
foreach($issue->labels as $label){
$issue->removeLabel($label);
}
$issue->state='closed';
$issue->title='deleted';
$issue->save();
}
};
//do the search and process the results
$repo->forIssues($tmp,['q'=>'delete me']);