分享web开发知识

注册/登录|最近发布|今日推荐

主页 IT知识网页技术软件开发前端开发代码编程运营维护技术分享教程案例
当前位置:首页 > 技术分享

adnanh webhook 框架 hook rule

发布时间:2023-09-06 02:16责任编辑:董明明关键词:暂无标签

adnanh webhook 支持一系列的逻辑操作

AND

所有的条件都必须匹配

{"and": ?[ ???{ ?????"match": ?????{ ???????"type": "value", ???????"value": "refs/heads/master", ???????"parameter": ???????{ ?????????"source": "payload", ?????????"name": "ref" ???????} ?????} ???}, ???{ ?????"match": ?????{ ???????"type": "regex", ???????"regex": ".*", ???????"parameter": ???????{ ?????????"source": "payload", ?????????"name": "repository.owner.name" ???????} ?????} ???} ?]}

OR

匹配条件中有一个为true 即可

{"or": ?[ ???{ ?????"match": ?????{ ???????"type": "value", ???????"value": "refs/heads/master", ???????"parameter": ???????{ ?????????"source": "payload", ?????????"name": "ref" ???????} ?????} ???}, ???{ ?????"match": ?????{ ???????"type": "value", ???????"value": "refs/heads/development", ???????"parameter": ???????{ ?????????"source": "payload", ?????????"name": "ref" ???????} ?????} ???} ?]}

NOT

为false 是执行

{"not": ?{ ???"match": ???{ ?????"type": "value", ?????"value": "refs/heads/development", ?????"parameter": ?????{ ???????"source": "payload", ???????"name": "ref" ?????} ???} ?}}

混合

{ ???"and": [ ???{ ???????"match": { ???????????"parameter": { ???????????????"source": "header", ???????????????"name": "X-Hub-Signature" ???????????}, ???????????"type": "payload-hash-sha1", ???????????"secret": "mysecret" ???????} ???}, ???{ ???????"or": [ ???????{ ???????????"match": ???????????{ ???????????????"parameter": ???????????????{ ???????????????????"source": "payload", ???????????????????"name": "ref" ???????????????}, ???????????????"type": "value", ???????????????"value": "refs/heads/master" ???????????} ???????}, ???????{ ???????????"match": ???????????{ ???????????????"parameter": ???????????????{ ???????????????????"source": "header", ???????????????????"name": "X-GitHub-Event" ???????????????}, ???????????????"type": "value", ???????????????"value": "ping" ???????????} ???????} ???????] ???} ???]}

match 原则

  • 值匹配
{ ?"match": ?{ ???"type": "value", ???"value": "refs/heads/development", ???"parameter": ???{ ?????"source": "payload", ?????"name": "ref" ???} ?}}
  • 正则匹配
{ ?"match": ?{ ???"type": "regex", ???"regex": ".*", ???"parameter": ???{ ?????"source": "payload", ?????"name": "ref" ???} ?}}
  • hash sha1 算法匹配
{ ?"match": ?{ ???"type": "payload-hash-sha1", ???"secret": "yoursecret", ???"parameter": ???{ ?????"source": "header", ?????"name": "X-Hub-Signature" ???} ?}}
  • ip 白名单匹配
{ ?"match": ?{ ???"type": "ip-whitelist", ???"ip-range": "192.168.0.1/24" ?}}

参考资料

https://github.com/adnanh/webhook/blob/master/docs/Hook-Rules.md

adnanh webhook 框架 hook rule

原文地址:https://www.cnblogs.com/rongfengliang/p/9703592.html

知识推荐

我的编程学习网——分享web前端后端开发技术知识。 垃圾信息处理邮箱 tousu563@163.com 网站地图
icp备案号 闽ICP备2023006418号-8 不良信息举报平台 互联网安全管理备案 Copyright 2023 www.wodecom.cn All Rights Reserved