Skip to content

git webhook,接受push回调,触发shell脚本

Notifications You must be signed in to change notification settings

gogogoghost/webhook

Repository files navigation

git webhook

支持gitee和github

使用方法

需要提前安装node npm

git clone https://github.com/gogogoghost/webhook

cd webhook

npm i

打开config.json,默认配置如下

  • key 后台设置的密码
  • branch 需要监控的分支
  • script scripts目录下的脚本文件名
  • site gitee/github,不写则该条无效

  • port http端口(不写默认6666)
  • path post接口的路径(不写默认/post-receive)
{
  "list": [{
    "key": "6cbc2339-f02a-4dbb-9087-b0bcc12ed229",
    "branch": "master",
    "script": "projectA.sh",
    "site": "github"
  },{
    "key": "369d87fe-e94a-4105-9c0e-b913cf011d8f",
    "branch": "dev",
    "script": "projectB.sh",
    "site": "gitee"
  }],
  "port":6666,
  "path": "/post-receive"
}

编写脚本:

cd scripts
mv sample.sh projectA.sh
vim projectA.sh
chmod +x projectA.sh

临时启动:

npm start

作为服务启动:

./service.sh install/uninstall

sudo systemctl start/stop/restart webhook

About

git webhook,接受push回调,触发shell脚本

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published