GiteaBot-examples/src/delete_labels.php
2019-11-10 15:02:44 +00:00

28 lines
815 B
PHP
Executable File

#!/usr/bin/php
<?php
/*
* This will loop through a list of label names
* If the label exists on the repo, delete the label
*/
// 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';
//define the repeat terms
$names = [
'janurary', 'feburary', 'march', 'april', 'may', 'june', 'july', 'august', 'september', 'october', 'november', 'december',
'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday',
'daily', 'weekly', 'fortnightly', 'monthly', 'yearly',
];
//loop through the names
foreach ($names as $name) {
//see if label exists?
$label = $repo->getLabelByName($name);
if ($label) { //it exists
//delete it
$repo->deleteLabel($label);
}
}