This PR created a mock webhook server in the tests and added integration tests for generic webhooks. It also fixes bugs in package webhooks and pull request comment webhooks. This also corrected an error on the package webhook. The previous implementation uses a `User` struct as an organization, now it has been corrected but it will not be consistent with the previous implementation, some fields which not belong to the organization have been removed. Backport #33396 Backport part of #33337
This commit is contained in:
parent
ebac324ff2
commit
23971a77a0
26 changed files with 682 additions and 105 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue