3.4 KiB
3.4 KiB
Examples for jhodges/GiteaBot
Install
- Clone or download and unpack this repo.
- Do a
composer install
- Copy 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 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
/************************************************
* Simple example to create a new label and issue
*************************************************/
###src/edit.php
/*******************************************************
* 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
********************************************************/
/**************************************************************
* 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!"
**************************************************************/
/****************************************************
* This will loop through a list of label names
* If the label exists on the repo, delete the label
****************************************************/
/**************************************************
* this will process all issues titled "delete me":
* 1. remove all labels
* 2. close the issue
* 3. change the title to "deleted"
**************************************************/
/***************************************************************************************************************
* 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')
****************************************************************************************************************/
/******************
* close ALL issues
******************/