brittyu/webhook-deploy

github webhook with php

dev-master 2020-02-17 12:23 UTC

This package is not auto-updated.

Last update: 2024-09-28 17:28:12 UTC


README

webhook-deploy

将此脚本放在服务器中,当github中的项目更新时,github的hook会向设置的url发送一个POST请求,然后通过运行脚本实现服务器与github数据的同步。

使用方法

通过composer安装

{
	"require": {
		"brittyu/webhook-deploy": "dev-master"
	}
}

添加自己的配置文件config.php

<?php

return $config =  [
    'base_dir' => __DIR__,
    'log_name' => 'webhook.log',
    'xiestorewebhook' => [
        'remote' => "origin",
        'branch' => 'master',
        'path' => '/your/server/path/',
        'secret' => 'your-key'
    ]
];

添加启动脚本

<?php

include "vendor/autoload.php";

use Webhook\Github;
use Webhook\ResolvePost;

$config = require_once "config.php";

$hook = new Github($config, new ResolvePost);
$hook->execute();

更多信息

我的博客

许可证

MIT