根据regexp规则自动标记github问题。
gitbot的Python项目详细描述
说明
应用程序将根据问题的标题、内容和/或 评论。标签由一组正则表达式规则决定。
文档
有关最新文档,请参阅documentation。
PIP安装
pip install gitbot
还安装gitbot可执行文件。
运行测试
- 克隆此存储库并在根目录中运行python setup.py test。 目录。默认情况下,需要验证的测试将是 从存储的betamax磁带重放。这应该足够了 案例。
- 重新生成betamax磁带
- 已填充auth_file环境变量并指向 auth.cfg文件。(请参见auth.cfg.sample示例内容)
- 让文件auth.cfg充满凭据并运行 python setup.py test在根目录中
- 通过pip download gitbot下载pip包。然后解压 gitbot-x.x.x.zip,cd进入目录并运行 python setup.py test。与上述相同的测试细节 申请。
建筑文档
要测试和构建gitbot文档,请执行以下操作: -将文件夹更改为docs。 -运行pip install -r requirements.txt。 -运行make html(或make.bat html在Windows上)生成文档,或 -运行make doctest(或make.bat doctest在Windows上)以运行文档测试。
操作模式
有两种运行bot的方法:
console-主动轮询github以查找新问题并基于给定的 选项标记它们。运行方式github_issues_bot.py console (...)
web app-被动地监听github的webhook通知 新问题或已更改的问题。监听github调用的端点是 /callback。可以从命令行运行 github_issues_bot.py web或使用 此wsgi配置:
import sys path = '/path/to/script/folder' if path not in sys.path: sys.path.append(path) from web\_listener import app as application
快速单层
^{tt20}$ Will process only body of the issue report. Any further comments nor the title of the issue will not be matched against rules.
规则
Rules are located in file rules.cfg by default. Any other file needs to be passed as a command line option. The format for rules is regexp=>desired label.
认证
Bot needs an authentication token with permissions to label issues. Token is stored in auth.cfg file by default. See the example file for details.
For web usage, the webhook secret has to be set in auth.cfg as well as the repository to be handled. The script will not do anything if the security check fails.
控制台模式的详细参数
Usage: github_issues_bot.py console [OPTIONS] REPOSITORIES... Options: -a, --auth TEXT Authentication file. See auth.cfg.sample. -v, --verbose Much verbosity. May be repeated multiple times. More v's, more info! -r, --rules-file TEXT File containing tagging rules. -i, --interval INTEGER Interval of repository checking in seconds. Default is 60 seconds. -d, --default-label TEXT Label to apply to an issue if no other rule applies. If empty, no label is applied. Defaults to no label. --process-title / --no-process-title Should the title of the issue be matched against the rules as well? Defaults to true. --comments / --no-comments Should comments be also matched against the rules? Defaults to true. --closed-issues / --no-closed-issues Should closed issues be still processed? Defaults to false. --skip-labelled / --no-skip-labelled Should issues that are labelled already be skipped? Defaults to true. --remove-current / --no-remove-current Should the current labels on an issue be removed if a rule matches? Defaults to false. --help Show this message and exit.