Browse Source

Add `branch_filter` to hooks API endpoints (#26599) (#26632)

Backport #26599 by @yardenshoham

We now include the branch filler in the response.

- Closes #26591 

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
Co-authored-by: Yarden Shoham <git@yardenshoham.com>
tags/v1.20.4
Giteabot 9 months ago
parent
commit
fe78aabc67
No account linked to committer's email address
3 changed files with 6 additions and 0 deletions
  1. 1
    0
      modules/structs/hook.go
  2. 1
    0
      services/webhook/general.go
  3. 4
    0
      templates/swagger/v1_json.tmpl

+ 1
- 0
modules/structs/hook.go View File

@@ -19,6 +19,7 @@ var ErrInvalidReceiveHook = errors.New("Invalid JSON payload received over webho
type Hook struct {
ID int64 `json:"id"`
Type string `json:"type"`
BranchFilter string `json:"branch_filter"`
URL string `json:"-"`
Config map[string]string `json:"config"`
Events []string `json:"events"`

+ 1
- 0
services/webhook/general.go View File

@@ -260,5 +260,6 @@ func ToHook(repoLink string, w *webhook_model.Webhook) (*api.Hook, error) {
AuthorizationHeader: authorizationHeader,
Updated: w.UpdatedUnix.AsTime(),
Created: w.CreatedUnix.AsTime(),
BranchFilter: w.BranchFilter,
}, nil
}

+ 4
- 0
templates/swagger/v1_json.tmpl View File

@@ -18910,6 +18910,10 @@
"type": "string",
"x-go-name": "AuthorizationHeader"
},
"branch_filter": {
"type": "string",
"x-go-name": "BranchFilter"
},
"config": {
"type": "object",
"additionalProperties": {

Loading…
Cancel
Save