Examples for [jhodges/GiteaBot](https://git.jhodges.co.uk/jhodges/GiteaBot) More advanced (incomplete) examples can be found at [jhodges/GiteaBot-repeat](https://git.jhodges.co.uk/jhodges/GiteaBot-repeat) ## Install 1. Clone or download and unpack this repo. 2. Do a `composer install` 3. Copy [src/config.php.dist](https://git.jhodges.co.uk/jhodges/GiteaBot-examples/src/branch/master/src/config.php.dist) to src/config.php and set your Gitea instalce URL and bots user/pass. ## Examples All examples include [src/setup.php](https://git.jhodges.co.uk/jhodges/GiteaBot-examples/src/branch/master/src/setup.php) which loads the autoloader and config, connects to the Gitea instance specified in config, passes the command line args, and opens the repo specified on command line. After this $client and $repo will be available. ---- ###[src/test.php](https://git.jhodges.co.uk/jhodges/GiteaBot-examples/src/branch/master/src/test.php) ```plain /************************************************ * Simple example to create a new label and issue *************************************************/ ``` ---- ###[src/edit.php](https://git.jhodges.co.uk/jhodges/GiteaBot-examples/src/branch/master/src/edit.php) ```plain /******************************************************* * This will loop through all issues and add some custom * text to the issue body. It will use a placeholder so * that it can be automatically updated without replacing * the whole issue body ********************************************************/ ``` ---- ###[src/delete_nags.php](https://git.jhodges.co.uk/jhodges/GiteaBot-examples/src/branch/master/src/delete_nags.php) ```plain /************************************************************** * This will delete all comments that match a specific keyword * 1. Process all issues that match "NAG!": * 2. Delete any comments that body exactly match "NAG!" **************************************************************/ ``` ---- ###[src/delete_labels.php](https://git.jhodges.co.uk/jhodges/GiteaBot-examples/src/branch/master/src/delete_labels.php) ```plain /**************************************************** * This will loop through a list of label names * If the label exists on the repo, delete the label ****************************************************/ ``` ---- ###[src/delete_me.php](https://git.jhodges.co.uk/jhodges/GiteaBot-examples/src/branch/master/src/delete_me.php) ```plain /************************************************** * this will process all issues titled "delete me": * 1. remove all labels * 2. close the issue * 3. change the title to "deleted" **************************************************/ ``` ---- ###[src/no_label_milestone.php](https://git.jhodges.co.uk/jhodges/GiteaBot-examples/src/branch/master/src/no_label_milestone.php) ```plain /*************************************************************************************************************** * 1. Adds a 'no-milestone' label to any issues with no milestone * 2. Removes the 'no-milestone' label if present on an issue with a milestone * 3. Adds a 'no-label' label to any issues with no labels (excluding 'no-label' and 'no-milestone') * 4. Removes the 'no-label' label if present on an issue with a label (excluding 'no-label' and 'no-milestone') ****************************************************************************************************************/ ``` ---- ###[src/close_all.php](https://git.jhodges.co.uk/jhodges/GiteaBot-examples/src/branch/master/src/close_all.php) ```plain /****************** * close ALL issues ******************/ ```