代码拉取完成,页面将自动刷新
git 代码推送通知
在公司进行开发时,如何优雅而又不尴尬的让老板知道自己每天几点下班,好让老板加工资,这是一个问题。
现在应该基本每个公司用钉钉,而钉钉又有机器人可以自动推送,😆,git 可以使用 webhook,于是,就有了这样一个系统。
当然,根据 git 的 webhook 特性,大家可以打开脑洞,随意实现有意思的功能。
composer require yansongda/git-notify
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());
MIT
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。