convert to using forIssues
This commit is contained in:
@@ -11,17 +11,18 @@
|
||||
// we will then have $client and $repo available
|
||||
require('setup.php');
|
||||
|
||||
//callback function to process the issues
|
||||
$tmp=function($issue) use ($repo){
|
||||
// loop through all matching issues
|
||||
// we use getIssues() here rather than forIssues() (see https://git.jhodges.co.uk/jhodges/GiteaBot/issues/1)
|
||||
foreach($repo->getIssues(['q'=>'delete me']) as $issue){
|
||||
// check for exact match
|
||||
if($issue->title=='delete me'){
|
||||
// remove all labels
|
||||
foreach($issue->labels as $label){
|
||||
$issue->removeLabel($label);
|
||||
}
|
||||
//change status and title.
|
||||
$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