GiteaBot-examples/README.md
2019-09-07 10:59:52 +01:00

4.0 KiB

Examples for jhodges/GiteaBot

Copy src/config.php.dist to src/config.php and set your Gitea instalce URL and bots user/pass.

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/repeat.php

/***********************************************************************
* This is designed to allow the use of labels to reopen recuring issues
* on a specific day, month or duration (daily/weekly/monthly etc)
* NOTE: This is not 100% implemented/tested. It's a WIP
* It will process any issue that is tagged with 'xxx/repeat' label
* The labels are grouped into days/months
* If an issue is closed then it will be reopened
* If an issue is already open the bot will comment "NAG!" about it
***********************************************************************/

###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
********************************************************/

###src/delete_nags.php

/**************************************************************
* 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

/****************************************************
* This will loop through a list of label names
* If the label exists on the repo, delete the label
****************************************************/

###src/delete_me.php

/**************************************************
* 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

/***************************************************************************************************************
* 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

/******************
* close ALL issues
******************/