pull/33442/head
Lunny Xiao 12 hours ago
parent 63694466f2
commit f1f5184d16
No known key found for this signature in database
GPG Key ID: C3B7C91B632F738A
  1. 17
      modules/webhook/type.go
  2. 3
      tests/integration/repo_webhook_test.go

@ -38,14 +38,6 @@ const (
// Event returns the HookEventType as an event string
func (h HookEventType) Event() string {
switch h {
case HookEventCreate:
return "create"
case HookEventDelete:
return "delete"
case HookEventFork:
return "fork"
case HookEventPush:
return "push"
case HookEventIssues, HookEventIssueAssign, HookEventIssueLabel, HookEventIssueMilestone:
return "issues"
case HookEventPullRequest, HookEventPullRequestAssign, HookEventPullRequestLabel, HookEventPullRequestMilestone,
@ -59,14 +51,9 @@ func (h HookEventType) Event() string {
return "pull_request_rejected"
case HookEventPullRequestReviewComment:
return "pull_request_comment"
case HookEventWiki:
return "wiki"
case HookEventRepository:
return "repository"
case HookEventRelease:
return "release"
default:
return string(h)
}
return ""
}
// HookType is the type of a webhook

@ -533,6 +533,9 @@ func Test_WebhookStatus(t *testing.T) {
assert.Contains(t, r.Header["X-Github-Event-Type"], "status", "X-GitHub-Event-Type should contain status")
assert.Contains(t, r.Header["X-Gitea-Event-Type"], "status", "X-Gitea-Event-Type should contain status")
assert.Contains(t, r.Header["X-Gogs-Event-Type"], "status", "X-Gogs-Event-Type should contain status")
assert.Contains(t, r.Header["X-Github-Event"], "status", "X-GitHub-Event should contain status")
assert.Contains(t, r.Header["X-Gitea-Event"], "status", "X-Gitea-Event should contain status")
assert.Contains(t, r.Header["X-Gogs-Event"], "status", "X-Gogs-Event should contain status")
content, _ := io.ReadAll(r.Body)
var payload api.CommitStatusPayload
err := json.Unmarshal(content, &payload)

Loading…
Cancel
Save