3 Star 1 Fork 1

yansongda / git-notify

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

😆Git Notify😆

git 代码推送通知

在公司进行开发时,如何优雅而又不尴尬的让老板知道自己每天几点下班,好让老板加工资,这是一个问题。

现在应该基本每个公司用钉钉,而钉钉又有机器人可以自动推送,😆,git 可以使用 webhook,于是,就有了这样一个系统。

当然,根据 git 的 webhook 特性,大家可以打开脑洞,随意实现有意思的功能

特性

  1. 隐藏不需要关心的内部流程
  2. 可以随意增加现有类库中没有的服务

支持的服务

git 提供商

  • gitee (码云)

destinations

  • dingtalk (钉钉)
    实现消息推送功能

安装

composer require yansongda/git-notify

使用方法

git webhook

http://your-domain/?from=gitee&to=dingtalk

服务端

<?php

require './vendor/autoload.php';

use Yansongda\Supports\Log;

// 可选。如果不配置,则日志保存在系统临时目录下
$config = [
    'log' => '/temp/GitNotify.log',
];
$notify = new Yansongda\GitNotify\GitNotify($config);

// 可选。gitee 可以设置 webhook 密码,防止 URL 被恶意请求
// $notify->from->password = '123456';

// 可选。可以随意设置发送模板与格式。这里用到闭包。
// $from 为 git 服务。
/* $notify->destination->setTemplate(function ($from) {
    $data['msgtype'] = 'hahaha';
    $data['text']['content'] = "姓名:" . $from->user_name .
                                "\n\before:" . $from->before .
                                "\n\nafter:" . $from->after .
                                "\n\n推送时间:" . date('Y-m-d H:i:s');

    return $data;
});*/

$notify->destination->gateway = 'https://oapi.dingtalk.com/robot/send?access_token=36c01ca8552fa8f9f6xxxxx';

$response = $notify->destination->apply();
Log::info('发送结果:', $response->getBody()->getContents());

LICENSE

MIT

The MIT License (MIT) Copyright (c) 2017 yansongda <me@yansongda.cn> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

git 代码推送通知服务 展开 收起
PHP
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
PHP
1
https://gitee.com/yansongda/git-notify.git
git@gitee.com:yansongda/git-notify.git
yansongda
git-notify
git-notify
master

搜索帮助