This commit is contained in:
James
2019-11-10 15:02:44 +00:00
parent 5352a3ea37
commit 3fcd44e9ce
9 changed files with 142 additions and 130 deletions

View File

@@ -1,28 +1,28 @@
#!/usr/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');
require 'setup.php';
// 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);
foreach ($repo->getIssues(['q' => 'delete me']) as $issue) {
// check for exact match
if ('delete me' == $issue->title) {
// remove all labels
foreach ($issue->labels as $label) {
$issue->removeLabel($label);
}
//change status and title.
$issue->state = 'closed';
$issue->title = 'deleted';
$issue->save();
}
//change status and title.
$issue->state='closed';
$issue->title='deleted';
$issue->save();
}
};
}