diff options
author | Giteabot <teabot@gitea.io> | 2023-08-21 20:17:19 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-21 12:17:19 +0000 |
commit | fe78aabc673daf36655f0cca7e83cf2b057b8361 (patch) | |
tree | 2035929498465303aaf75f0ef1b78e3611764fc7 | |
parent | 4aed0e6b074b538ba71ba0560a416f282b3cc30b (diff) | |
download | gitea-fe78aabc673daf36655f0cca7e83cf2b057b8361.tar.gz gitea-fe78aabc673daf36655f0cca7e83cf2b057b8361.zip |
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>
-rw-r--r-- | modules/structs/hook.go | 1 | ||||
-rw-r--r-- | services/webhook/general.go | 1 | ||||
-rw-r--r-- | templates/swagger/v1_json.tmpl | 4 |
3 files changed, 6 insertions, 0 deletions
diff --git a/modules/structs/hook.go b/modules/structs/hook.go index cd91d4bc46..0babe84410 100644 --- a/modules/structs/hook.go +++ b/modules/structs/hook.go @@ -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"` diff --git a/services/webhook/general.go b/services/webhook/general.go index f53ea31ffa..b9cc3dc845 100644 --- a/services/webhook/general.go +++ b/services/webhook/general.go @@ -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 } diff --git a/templates/swagger/v1_json.tmpl b/templates/swagger/v1_json.tmpl index 8b4d4867f1..6bedcfd4f0 100644 --- a/templates/swagger/v1_json.tmpl +++ b/templates/swagger/v1_json.tmpl @@ -18910,6 +18910,10 @@ "type": "string", "x-go-name": "AuthorizationHeader" }, + "branch_filter": { + "type": "string", + "x-go-name": "BranchFilter" + }, "config": { "type": "object", "additionalProperties": { |