2024-02-11 09:42:01 +00:00
|
|
|
package api
|
|
|
|
|
|
|
|
import (
|
|
|
|
"code.gitea.io/gitea/modules/structs"
|
|
|
|
"github.com/google/go-github/v59/github"
|
|
|
|
)
|
|
|
|
|
|
|
|
func convertPullRequestEvent(event *structs.PullRequestPayload) *github.PullRequestEvent {
|
2024-02-11 10:22:35 +00:00
|
|
|
if len(event.PullRequest.RequestedReviewers) == 0 {
|
|
|
|
event.PullRequest.RequestedReviewers = append(event.PullRequest.RequestedReviewers, nil)
|
|
|
|
}
|
|
|
|
|
|
|
|
if len(event.PullRequest.Labels) == 0 {
|
|
|
|
event.PullRequest.Labels = append(event.PullRequest.Labels, nil)
|
|
|
|
}
|
|
|
|
|
2024-02-11 09:42:01 +00:00
|
|
|
return &github.PullRequestEvent{
|
2024-02-12 09:14:46 +00:00
|
|
|
Action: stringPtr(translatePrAction(event.Action, false)),
|
2024-02-12 21:42:00 +00:00
|
|
|
PullRequest: convertCorePullRequest(event.PullRequest),
|
2024-02-12 06:57:43 +00:00
|
|
|
Repo: convertCoreRepo(event.Repository),
|
|
|
|
Assignee: convertCoreUser(event.PullRequest.Assignee),
|
2024-02-11 10:08:41 +00:00
|
|
|
Number: intPtr(int(event.Index)),
|
|
|
|
Changes: convertChanges(event.Changes),
|
2024-02-12 06:57:43 +00:00
|
|
|
RequestedReviewer: convertCoreUser(event.PullRequest.RequestedReviewers[0]),
|
|
|
|
Sender: convertCoreUser(event.Sender),
|
|
|
|
Label: convertCoreLabel(event.PullRequest.Labels[0]),
|
2024-02-11 09:42:01 +00:00
|
|
|
}
|
|
|
|
}
|