当特定包在github上获得新版本时得到通知
github-release-notifier的Python项目详细描述
Github发布通知程序
此程序将允许您收到github新版本的通知
安装
pip3 install github-release-notifier
使用量
usage: github-release-notifier [-h] [--action {cron,subscribe,unsubscribe}] [--package PACKAGE] [--webhook WEBHOOK] [--uuid UUID] optional arguments: -h, --help show this help message and exit --action {cron,subscribe,unsubscribe}, -a {cron,subscribe,unsubscribe} Action to do (default: cron) --package PACKAGE, -p PACKAGE Github package name / url (required for subscribe/unsubscribe) - prints uuid on subscription --webhook WEBHOOK, -w WEBHOOK URL to your webhook (required for subscribe/unsubscribe) --uuid UUID, -u UUID UUID of your webhook (required for unsubscribe)
示例
首先,我注册我的webhook:
github-release-notifier --action subscribe --webhook https://example.com/updated --package jaymoulin/google-music-manager
将打印uuid。取消订阅webhook需要此uuid。
当jaymoolin/google音乐管理器发布一个新版本时,https://example.com/updated将使用http方法post和body调用,一个类似这样的json:
{ "date": [2017, 11, 13, 19, 46, 35, 0, 317, 0], "version": "0.7.2", "title": "Fixes split modules", "content": "", "media": "https://avatars0.githubusercontent.com/u/14236493?s=60&v=4", "author": "jaymoulin" "package_name": "jaymoulin/google-music-manager" }
为了实现这一点,系统应该检查是否发布了新版本。 我们可以通过调用github release notifier来实现这一点,无需任何参数或将action设置为cron(这是默认设置)。
要使此过程自动化,我们可以将此过程添加到cronjob中:
(crontab -l ; echo "0 0 * * * github-release-notifier") | sort - | uniq - | crontab -
如果新版本已经发布,这将每天午夜检查。
配置
可以定义环境变量来更改默认的hooks或版本数据库文件(纯json文件)
GRN_VERSIONS_FILE: Path to saved versions (default: ${HOME}/.github_release_notifier/versions) GRN_HOOKS_FILE: Path to hooks configuration (default: ${HOME}/.github_release_notifier/hooks)
Docker用法
首先运行后台程序
docker run --name GRN -d femtopixel/github-release-notifier
您可以将卷装载到/root/.github\u release\u notifier/以跟踪webhook和版本
示例:
docker run --name GRN -d -v /path/to/your/saves:/root/.github_release_notifier/ femtopixel/github-release-notifier
然后注册webhook:
docker exec GRN -a subscribe -p jaymoulin/google-music-manager -w https://example.com/updated
提交错误和功能请求
在github上跟踪错误和功能请求
许可证
github release notifier是根据mit许可证授权的