Skip to content

Commit f1f5184

Browse files
committed
Fix bug
1 parent 6369446 commit f1f5184

File tree

2 files changed

+5
-15
lines changed

2 files changed

+5
-15
lines changed

modules/webhook/type.go

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,6 @@ const (
3838
// Event returns the HookEventType as an event string
3939
func (h HookEventType) Event() string {
4040
switch h {
41-
case HookEventCreate:
42-
return "create"
43-
case HookEventDelete:
44-
return "delete"
45-
case HookEventFork:
46-
return "fork"
47-
case HookEventPush:
48-
return "push"
4941
case HookEventIssues, HookEventIssueAssign, HookEventIssueLabel, HookEventIssueMilestone:
5042
return "issues"
5143
case HookEventPullRequest, HookEventPullRequestAssign, HookEventPullRequestLabel, HookEventPullRequestMilestone,
@@ -59,14 +51,9 @@ func (h HookEventType) Event() string {
5951
return "pull_request_rejected"
6052
case HookEventPullRequestReviewComment:
6153
return "pull_request_comment"
62-
case HookEventWiki:
63-
return "wiki"
64-
case HookEventRepository:
65-
return "repository"
66-
case HookEventRelease:
67-
return "release"
54+
default:
55+
return string(h)
6856
}
69-
return ""
7057
}
7158

7259
// HookType is the type of a webhook

tests/integration/repo_webhook_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,9 @@ func Test_WebhookStatus(t *testing.T) {
533533
assert.Contains(t, r.Header["X-Github-Event-Type"], "status", "X-GitHub-Event-Type should contain status")
534534
assert.Contains(t, r.Header["X-Gitea-Event-Type"], "status", "X-Gitea-Event-Type should contain status")
535535
assert.Contains(t, r.Header["X-Gogs-Event-Type"], "status", "X-Gogs-Event-Type should contain status")
536+
assert.Contains(t, r.Header["X-Github-Event"], "status", "X-GitHub-Event should contain status")
537+
assert.Contains(t, r.Header["X-Gitea-Event"], "status", "X-Gitea-Event should contain status")
538+
assert.Contains(t, r.Header["X-Gogs-Event"], "status", "X-Gogs-Event should contain status")
536539
content, _ := io.ReadAll(r.Body)
537540
var payload api.CommitStatusPayload
538541
err := json.Unmarshal(content, &payload)

0 commit comments

Comments
 (0)