新增:webhook type类型
This commit is contained in:
parent
ef32b08ee4
commit
cf39a4b405
|
@ -130,6 +130,7 @@ const (
|
|||
MSTEAMS HookType = "msteams"
|
||||
FEISHU HookType = "feishu"
|
||||
MATRIX HookType = "matrix"
|
||||
JIANMU HookType = "jianmu"
|
||||
)
|
||||
|
||||
// HookStatus is the status of a web hook
|
||||
|
|
|
@ -58,7 +58,7 @@ type CreateHookOptionConfig map[string]string
|
|||
// CreateHookOption options when create a hook
|
||||
type CreateHookOption struct {
|
||||
// required: true
|
||||
// enum: dingtalk,discord,gitea,gogs,msteams,slack,telegram,feishu
|
||||
// enum: dingtalk,discord,gitea,gogs,msteams,slack,telegram,feishu,jianmu
|
||||
Type string `json:"type" binding:"Required"`
|
||||
// required: true
|
||||
Config CreateHookOptionConfig `json:"config" binding:"Required"`
|
||||
|
|
|
@ -65,6 +65,12 @@ func IsValidHookTaskType(name string) bool {
|
|||
if name == models.GITEA || name == models.GOGS {
|
||||
return true
|
||||
}
|
||||
|
||||
// 建木devops
|
||||
if name == models.JIANMU {
|
||||
return true
|
||||
}
|
||||
|
||||
_, ok := webhooks[models.HookType(name)]
|
||||
return ok
|
||||
}
|
||||
|
@ -135,7 +141,7 @@ func prepareWebhook(w *models.Webhook, repo *models.Repository, event models.Hoo
|
|||
// Avoid sending "0 new commits" to non-integration relevant webhooks (e.g. slack, discord, etc.).
|
||||
// Integration webhooks (e.g. drone) still receive the required data.
|
||||
if pushEvent, ok := p.(*api.PushPayload); ok &&
|
||||
w.Type != models.GITEA && w.Type != models.GOGS &&
|
||||
w.Type != models.GITEA && w.Type != models.GOGS && w.Type != models.JIANMU &&
|
||||
len(pushEvent.Commits) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -14615,7 +14615,8 @@
|
|||
"msteams",
|
||||
"slack",
|
||||
"telegram",
|
||||
"feishu"
|
||||
"feishu",
|
||||
"jianmu"
|
||||
],
|
||||
"x-go-name": "Type"
|
||||
}
|
||||
|
@ -15387,6 +15388,9 @@
|
|||
"format": "int64",
|
||||
"x-go-name": "Deletion"
|
||||
},
|
||||
"Diff": {
|
||||
"type": "string"
|
||||
},
|
||||
"Index": {
|
||||
"type": "integer",
|
||||
"format": "int64"
|
||||
|
|
Loading…
Reference in New Issue