From ba67c79b0d3c8af1288e191a52e208346a08d9f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E8=8C=B6=E6=B8=85=E6=AC=A2?= Date: Fri, 12 Nov 2021 16:46:59 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9D=9Emaster=E5=88=86=E6=94=AF=E4=BB=A3?= =?UTF-8?q?=E7=A0=81,=E4=B8=8D=E5=81=9A=E4=BB=BB=E4=BD=95=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- git_hook.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/git_hook.go b/git_hook.go index 2133302..6d4bad1 100644 --- a/git_hook.go +++ b/git_hook.go @@ -16,6 +16,14 @@ func main() { router := gin.Default() // 注册回调路由 _ = git_hook.RegisterGitHookRouter(router, func(ctx *gin.Context, hookData *git_hook.HookData) *git_hook.ResponseData { + if hookData.Ref != "refs/heads/master" { + // 不是master分支, 不触发相应逻辑 + return &git_hook.ResponseData{ + Code: 0, + Message: "成功接收到web hook通知, 非master分支,不做任何处理", + Data: hookData, + } + } return &git_hook.ResponseData{ Code: 0, Message: "成功接收到web hook通知",