From f2f177c46f58873b309212db0aea5c38e20de1d0 Mon Sep 17 00:00:00 2001 From: claire1618 <55173466+claire1618@users.noreply.github.com> Date: Fri, 2 Feb 2024 12:59:52 -0600 Subject: [PATCH] fix: changing ProcessWebhook so that the deployment ref is only set once (#1054) Co-authored-by: Claire.Nicholas --- scm/github/webhook.go | 2 -- scm/github/webhook_test.go | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/scm/github/webhook.go b/scm/github/webhook.go index f6f8a2295..a0b53cd1f 100644 --- a/scm/github/webhook.go +++ b/scm/github/webhook.go @@ -412,8 +412,6 @@ func (c *client) processDeploymentEvent(h *library.Hook, payload *github.Deploym fmt.Sprintf("https://%s/%s/settings/hooks", h.GetHost(), r.GetFullName()), ) - d.SetRef(b.GetRef()) - return &types.Webhook{ Hook: h, Repo: r, diff --git a/scm/github/webhook_test.go b/scm/github/webhook_test.go index 10fe49b43..a5d5ec5b2 100644 --- a/scm/github/webhook_test.go +++ b/scm/github/webhook_test.go @@ -565,7 +565,7 @@ func TestGithub_ProcessWebhook_Deployment(t *testing.T) { wantDeployment.SetNumber(145988746) wantDeployment.SetURL("https://api.github.com/repos/Codertocat/Hello-World/deployments/145988746") wantDeployment.SetCommit("f95f852bd8fca8fcc58a9a2d6c842781e32a215e") - wantDeployment.SetRef("refs/heads/main") + wantDeployment.SetRef("main") wantDeployment.SetTask("deploy") wantDeployment.SetTarget("production") wantDeployment.SetDescription("") @@ -698,7 +698,7 @@ func TestGithub_ProcessWebhook_Deployment_Commit(t *testing.T) { wantDeployment.SetNumber(145988746) wantDeployment.SetURL("https://api.github.com/repos/Codertocat/Hello-World/deployments/145988746") wantDeployment.SetCommit("f95f852bd8fca8fcc58a9a2d6c842781e32a215e") - wantDeployment.SetRef("refs/heads/main") + wantDeployment.SetRef("f95f852bd8fca8fcc58a9a2d6c842781e32a215e") wantDeployment.SetTask("deploy") wantDeployment.SetTarget("production") wantDeployment.SetDescription("")