From ea957692fb50d1bec05d979e30cfc2807b041cae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1rio=20Santos?= Date: Fri, 13 Nov 2026 12:30:02 +0000 Subject: [PATCH] fix(api): allow subscribing to all webhook events MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mário Santos --- api/v1alpha1/applyconfiguration/api/v1alpha1/webhookspec.go | 3 ++- api/v1alpha1/webhookpreset_types.go | 5 +++-- config/crd/bases/github.interhyp.de_repositories.yaml | 4 +++- config/crd/bases/github.interhyp.de_webhookpresets.yaml | 4 +++- docs/crds.md | 2 +- schemas/repository_v1alpha1.json | 3 ++- schemas/webhookpreset_v1alpha1.json | 3 ++- 7 files changed, 16 insertions(+), 8 deletions(-) diff --git a/api/v1alpha1/applyconfiguration/api/v1alpha1/webhookspec.go b/api/v1alpha1/applyconfiguration/api/v1alpha1/webhookspec.go index cdf8c26..fff51e9 100644 --- a/api/v1alpha1/applyconfiguration/api/v1alpha1/webhookspec.go +++ b/api/v1alpha1/applyconfiguration/api/v1alpha1/webhookspec.go @@ -50,7 +50,8 @@ type WebhookSpecApplyConfiguration struct { // Set to false to temporarily disable the webhook without deleting it. Active *bool `json:"active,omitempty"` // Events is a list of GitHub event types that trigger this webhook. - // If empty, the webhook subscribes to all events ("*"). + // If omitted or empty, the webhook subscribes to "push". + // Set events to ["*"] to subscribe to all events. // Common events include "push", "pull_request", "issues", "release". // See: https://docs.github.com/en/webhooks/webhook-events-and-payloads Events []string `json:"events,omitempty"` diff --git a/api/v1alpha1/webhookpreset_types.go b/api/v1alpha1/webhookpreset_types.go index 51f8630..8789cb4 100644 --- a/api/v1alpha1/webhookpreset_types.go +++ b/api/v1alpha1/webhookpreset_types.go @@ -56,14 +56,15 @@ type WebhookSpec struct { Active *bool `json:"active,omitempty"` // Events is a list of GitHub event types that trigger this webhook. - // If empty, the webhook subscribes to all events ("*"). + // If omitted or empty, the webhook subscribes to "push". + // Set events to ["*"] to subscribe to all events. // Common events include "push", "pull_request", "issues", "release". // See: https://docs.github.com/en/webhooks/webhook-events-and-payloads // +kubebuilder:validation:Type=array // +kubebuilder:validation:MinItems=0 // +kubebuilder:validation:MaxItems=100 // +kubebuilder:validation:Items=string - // +kubebuilder:validation:items:Enum=branch_protection_rule;check_run;check_suite;code_scanning_alert;commit_comment;create;delete;dependabot_alert;deploy_key;deployment;deployment_status;discussion;discussion_comment;fork;github_app_authorization;gollum;installation;installation_repositories;issue_comment;issues;label;marketplace_purchase;member;membership;merge_group;meta;milestone;organization;org_block;package;page_build;ping;project;project_card;project_column;public;pull_request;pull_request_review;pull_request_review_comment;pull_request_review_thread;push;registry_package;release;repository;repository_dispatch;repository_import;repository_vulnerability_alert;secret_scanning_alert;security_advisory;sponsorship;star;status;team;team_add;watch;workflow_dispatch;workflow_job;workflow_run + // +kubebuilder:validation:items:Enum="*";branch_protection_rule;check_run;check_suite;code_scanning_alert;commit_comment;create;delete;dependabot_alert;deploy_key;deployment;deployment_status;discussion;discussion_comment;fork;github_app_authorization;gollum;installation;installation_repositories;issue_comment;issues;label;marketplace_purchase;member;membership;merge_group;meta;milestone;organization;org_block;package;page_build;ping;project;project_card;project_column;public;pull_request;pull_request_review;pull_request_review_comment;pull_request_review_thread;push;registry_package;release;repository;repository_dispatch;repository_import;repository_vulnerability_alert;secret_scanning_alert;security_advisory;sponsorship;star;status;team;team_add;watch;workflow_dispatch;workflow_job;workflow_run Events []string `json:"events,omitempty"` // SSLVerify enables SSL certificate verification for the webhook endpoint. diff --git a/config/crd/bases/github.interhyp.de_repositories.yaml b/config/crd/bases/github.interhyp.de_repositories.yaml index 0d97539..d9dd398 100644 --- a/config/crd/bases/github.interhyp.de_repositories.yaml +++ b/config/crd/bases/github.interhyp.de_repositories.yaml @@ -1292,11 +1292,13 @@ spec: events: description: |- Events is a list of GitHub event types that trigger this webhook. - If empty, the webhook subscribes to all events ("*"). + If omitted or empty, the webhook subscribes to "push". + Set events to ["*"] to subscribe to all events. Common events include "push", "pull_request", "issues", "release". See: https://docs.github.com/en/webhooks/webhook-events-and-payloads items: enum: + - '*' - branch_protection_rule - check_run - check_suite diff --git a/config/crd/bases/github.interhyp.de_webhookpresets.yaml b/config/crd/bases/github.interhyp.de_webhookpresets.yaml index 57f33e6..69c1411 100644 --- a/config/crd/bases/github.interhyp.de_webhookpresets.yaml +++ b/config/crd/bases/github.interhyp.de_webhookpresets.yaml @@ -58,11 +58,13 @@ spec: events: description: |- Events is a list of GitHub event types that trigger this webhook. - If empty, the webhook subscribes to all events ("*"). + If omitted or empty, the webhook subscribes to "push". + Set events to ["*"] to subscribe to all events. Common events include "push", "pull_request", "issues", "release". See: https://docs.github.com/en/webhooks/webhook-events-and-payloads items: enum: + - '*' - branch_protection_rule - check_run - check_suite diff --git a/docs/crds.md b/docs/crds.md index ab3fbce..38f4ba2 100644 --- a/docs/crds.md +++ b/docs/crds.md @@ -1512,7 +1512,7 @@ _Appears in:_ | `secretValue` _string_ | SecretValue is the plaintext value of the webhook secret.
Use this for simple cases, but Secret (referencing a Kubernetes Secret) is more secure.
If both Secret and SecretValue are provided, Secret takes precedence. | | Type: string
| | `contentType` _string_ | ContentType specifies the format of the webhook payload.
- "json": Send payload as application/json (recommended)
- "form": Send payload as application/x-www-form-urlencoded
See: https://docs.github.com/en/webhooks/webhook-events-and-payloads | | Enum: [json form]
Type: string
| | `active` _boolean_ | Active determines whether the webhook is active and will send events.
Set to false to temporarily disable the webhook without deleting it. | true | | -| `events` _string array_ | Events is a list of GitHub event types that trigger this webhook.
If empty, the webhook subscribes to all events ("*").
Common events include "push", "pull_request", "issues", "release".
See: https://docs.github.com/en/webhooks/webhook-events-and-payloads | | MaxItems: 100
MinItems: 0
Type: array
items:Enum: [branch_protection_rule check_run check_suite code_scanning_alert commit_comment create delete dependabot_alert deploy_key deployment deployment_status discussion discussion_comment fork github_app_authorization gollum installation installation_repositories issue_comment issues label marketplace_purchase member membership merge_group meta milestone organization org_block package page_build ping project project_card project_column public pull_request pull_request_review pull_request_review_comment pull_request_review_thread push registry_package release repository repository_dispatch repository_import repository_vulnerability_alert secret_scanning_alert security_advisory sponsorship star status team team_add watch workflow_dispatch workflow_job workflow_run]
| +| `events` _string array_ | Events is a list of GitHub event types that trigger this webhook.
If omitted or empty, the webhook subscribes to "push".
Set events to ["*"] to subscribe to all events.
Common events include "push", "pull_request", "issues", "release".
See: https://docs.github.com/en/webhooks/webhook-events-and-payloads | | MaxItems: 100
MinItems: 0
Type: array
items:Enum: [* branch_protection_rule check_run check_suite code_scanning_alert commit_comment create delete dependabot_alert deploy_key deployment deployment_status discussion discussion_comment fork github_app_authorization gollum installation installation_repositories issue_comment issues label marketplace_purchase member membership merge_group meta milestone organization org_block package page_build ping project project_card project_column public pull_request pull_request_review pull_request_review_comment pull_request_review_thread push registry_package release repository repository_dispatch repository_import repository_vulnerability_alert secret_scanning_alert security_advisory sponsorship star status team team_add watch workflow_dispatch workflow_job workflow_run]
| | `sslVerify` _boolean_ | SSLVerify enables SSL certificate verification for the webhook endpoint.
When true, GitHub verifies the SSL certificate of the PayloadURL.
Disable only for testing with self-signed certificates; always enable in production. | true | | diff --git a/schemas/repository_v1alpha1.json b/schemas/repository_v1alpha1.json index 1e37413..772fe23 100644 --- a/schemas/repository_v1alpha1.json +++ b/schemas/repository_v1alpha1.json @@ -1121,9 +1121,10 @@ "type": "string" }, "events": { - "description": "Events is a list of GitHub event types that trigger this webhook.\nIf empty, the webhook subscribes to all events (\"*\").\nCommon events include \"push\", \"pull_request\", \"issues\", \"release\".\nSee: https://docs.github.com/en/webhooks/webhook-events-and-payloads", + "description": "Events is a list of GitHub event types that trigger this webhook.\nIf omitted or empty, the webhook subscribes to \"push\".\nSet events to [\"*\"] to subscribe to all events.\nCommon events include \"push\", \"pull_request\", \"issues\", \"release\".\nSee: https://docs.github.com/en/webhooks/webhook-events-and-payloads", "items": { "enum": [ + "*", "branch_protection_rule", "check_run", "check_suite", diff --git a/schemas/webhookpreset_v1alpha1.json b/schemas/webhookpreset_v1alpha1.json index 6ebb6d9..6781ae6 100644 --- a/schemas/webhookpreset_v1alpha1.json +++ b/schemas/webhookpreset_v1alpha1.json @@ -29,9 +29,10 @@ "type": "string" }, "events": { - "description": "Events is a list of GitHub event types that trigger this webhook.\nIf empty, the webhook subscribes to all events (\"*\").\nCommon events include \"push\", \"pull_request\", \"issues\", \"release\".\nSee: https://docs.github.com/en/webhooks/webhook-events-and-payloads", + "description": "Events is a list of GitHub event types that trigger this webhook.\nIf omitted or empty, the webhook subscribes to \"push\".\nSet events to [\"*\"] to subscribe to all events.\nCommon events include \"push\", \"pull_request\", \"issues\", \"release\".\nSee: https://docs.github.com/en/webhooks/webhook-events-and-payloads", "items": { "enum": [ + "*", "branch_protection_rule", "check_run", "check_suite",