diff --git a/scm/github/webhook.go b/scm/github/webhook.go index 9e9dccac5..47aefee38 100644 --- a/scm/github/webhook.go +++ b/scm/github/webhook.go @@ -363,6 +363,7 @@ func (c *client) processDeploymentEvent(h *library.Hook, payload *github.Deploym // convert payload to library build b := new(library.Build) b.SetEvent(constants.EventDeploy) + b.SetEventAction(constants.ActionCreated) b.SetClone(repo.GetCloneURL()) b.SetDeploy(payload.GetDeployment().GetEnvironment()) b.SetDeployNumber(payload.GetDeployment().GetID()) @@ -427,6 +428,7 @@ func (c *client) processDeploymentEvent(h *library.Hook, payload *github.Deploym // update the hook object h.SetBranch(b.GetBranch()) h.SetEvent(constants.EventDeploy) + h.SetEventAction(constants.ActionCreated) h.SetLink( fmt.Sprintf("https://%s/%s/settings/hooks", h.GetHost(), r.GetFullName()), ) diff --git a/scm/github/webhook_test.go b/scm/github/webhook_test.go index 00454fdf7..50aea20b4 100644 --- a/scm/github/webhook_test.go +++ b/scm/github/webhook_test.go @@ -574,7 +574,8 @@ func TestGithub_ProcessWebhook_Deployment(t *testing.T) { wantHook.SetBranch("main") wantHook.SetLink("https://github.com/Codertocat/Hello-World/settings/hooks") wantHook.SetHost("github.com") - wantHook.SetEvent("deployment") + wantHook.SetEvent(constants.EventDeploy) + wantHook.SetEventAction(constants.ActionCreated) wantHook.SetStatus(constants.StatusSuccess) wantRepo := new(api.Repo) @@ -588,7 +589,8 @@ func TestGithub_ProcessWebhook_Deployment(t *testing.T) { wantRepo.SetTopics(nil) wantBuild := new(library.Build) - wantBuild.SetEvent("deployment") + wantBuild.SetEvent(constants.EventDeploy) + wantBuild.SetEventAction(constants.ActionCreated) wantBuild.SetClone("https://github.com/Codertocat/Hello-World.git") wantBuild.SetDeploy("production") wantBuild.SetDeployNumber(145988746) @@ -707,7 +709,8 @@ func TestGithub_ProcessWebhook_Deployment_Commit(t *testing.T) { wantHook.SetBranch("main") wantHook.SetLink("https://github.com/Codertocat/Hello-World/settings/hooks") wantHook.SetHost("github.com") - wantHook.SetEvent("deployment") + wantHook.SetEvent(constants.EventDeploy) + wantHook.SetEventAction(constants.ActionCreated) wantHook.SetStatus(constants.StatusSuccess) wantRepo := new(api.Repo) @@ -721,7 +724,8 @@ func TestGithub_ProcessWebhook_Deployment_Commit(t *testing.T) { wantRepo.SetTopics(nil) wantBuild := new(library.Build) - wantBuild.SetEvent("deployment") + wantBuild.SetEvent(constants.EventDeploy) + wantBuild.SetEventAction(constants.ActionCreated) wantBuild.SetClone("https://github.com/Codertocat/Hello-World.git") wantBuild.SetDeploy("production") wantBuild.SetDeployNumber(145988746)