From 34566aa802dbc2c511e1946f9525577c676539e5 Mon Sep 17 00:00:00 2001 From: Chakrit Wichian Date: Wed, 6 Nov 2024 14:22:36 +0700 Subject: [PATCH] Fix github webhook payload detection logic (#728) The correct value for "package_type" seems to be "CONTAINER" instead of "docker" --- pkg/http/github_webhook_trigger.go | 4 ++-- pkg/http/github_webhook_trigger_test.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/http/github_webhook_trigger.go b/pkg/http/github_webhook_trigger.go index a4673eb0..3e84d6df 100644 --- a/pkg/http/github_webhook_trigger.go +++ b/pkg/http/github_webhook_trigger.go @@ -120,9 +120,9 @@ func (s *TriggerServer) githubHandler(resp http.ResponseWriter, req *http.Reques return } - if payload.RegistryPackage.PackageType != "docker" { + if payload.RegistryPackage.PackageType != "CONTAINER" { resp.WriteHeader(http.StatusBadRequest) - fmt.Fprintf(resp, "registry package type was not docker") + fmt.Fprintf(resp, "registry package type was not CONTAINER") } if payload.Repository.FullName == "" { // github package name diff --git a/pkg/http/github_webhook_trigger_test.go b/pkg/http/github_webhook_trigger_test.go index f8e27ff9..c91e6a65 100644 --- a/pkg/http/github_webhook_trigger_test.go +++ b/pkg/http/github_webhook_trigger_test.go @@ -13,7 +13,7 @@ var fakeGithubPackageWebhook = `{ "registry_package": { "id": 35087, "name": "server", - "package_type": "docker", + "package_type": "CONTAINER", "html_url": "https://github.com/DingGGu/UtaiteBOX/packages/35087", "created_at": "2019-10-11T18:18:58Z", "updated_at": "2019-10-11T18:18:58Z",