pruno/github-webhooks

用于处理同一平台上的多个Github webhook的实用工具

2.0.0 2014-02-18 17:25 UTC

This package is not auto-updated.

Last update: 2024-09-14 15:37:25 UTC


README

Github Webhooks 库(支持事件)。

简介

此库旨在提供

  • 一个简单且可嵌入的事件库

  • 一个方便的独立服务器类

  • 一个事件监听器以执行 git pull

    • 支持多个部署密钥
    • 注意:仅适用于Linux

要求

  • php >=5.3.3

可选

  • git(使用拉取事件监听器)

安装

使用 composer

将以下内容添加到您的 composer.json 文件中

"require": {
    "pruno/github-webhooks": "2.0.*",
},
"repositories": [
    {
        "type": "vcs",
        "url": "https://github.com/pruno/github-webhooks.git"
    }
]

或者使用git子模块

git submodule add https://github.com/pruno/github-webhooks.git pruno/github-webhooks

快速实现(在推送事件上拉取)

1 - 创建一个 Github Webhook

 - Set an arbitrary URL path (this will be your hook id) 
   (e.g: https://example.com/POSTRECEIVE)
 - Both payload versions are supported.
 - The push event is enough.

1 - 将 sample/composer.json 复制到您的项目根目录。

2 - 执行 composer install

3 - 将 sample/index.php 复制到您的公开目录。

4 - 编辑 sample/index.php,使用

 - hook information (line 9).
 - git working copy information (line 14).

5 - 完成后,您可以删除第12行。

注意
请记住,运行您的web服务器(或fast-cgi进程)的用户需要对其git工作副本有写权限。

嵌入

请参考 library/GithubWebhooks/Server.php 作为实现示例。

贡献

请这样做。将其Fork并提交pull请求。

许可

本软件在New-BSD许可下发布。