29 lines
856 B
PHP
Executable File
29 lines
856 B
PHP
Executable File
#!/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';
|
|
|
|
// 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 ('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();
|
|
}
|
|
}
|