add some delete examples
This commit is contained in:
27
src/delete_me.php
Executable file
27
src/delete_me.php
Executable 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']);
|
Reference in New Issue
Block a user