feat: add convertCorePullRequest
This commit is contained in:
parent
e33587b406
commit
c345f1c72a
|
@ -212,7 +212,46 @@ func convertCoreRepo(repo *structs.Repository) *github.Repository {
|
|||
}
|
||||
}
|
||||
|
||||
func convertPullRequest(request *structs.PullRequest) *github.PullRequest {
|
||||
func convertPullRequest(request *gitea.PullRequest) *github.PullRequest {
|
||||
if request == nil {
|
||||
return &github.PullRequest{}
|
||||
}
|
||||
pr := &github.PullRequest{
|
||||
ID: int64Ptr(request.ID),
|
||||
Number: intPtr(int(request.Index)),
|
||||
State: stringPtr(string(request.State)),
|
||||
Title: stringPtr(request.Title),
|
||||
Body: stringPtr(request.Body),
|
||||
CreatedAt: timePtr(*request.Created),
|
||||
UpdatedAt: timePtr(*request.Updated),
|
||||
ClosedAt: timePtrIfNotNil(request.Closed),
|
||||
MergedAt: timePtrIfNotNil(request.Merged),
|
||||
Merged: boolPtr(request.HasMerged),
|
||||
Mergeable: boolPtr(request.Mergeable),
|
||||
MergeCommitSHA: request.MergedCommitID,
|
||||
URL: stringPtr(request.URL),
|
||||
HTMLURL: stringPtr(request.HTMLURL),
|
||||
DiffURL: stringPtr(request.DiffURL),
|
||||
PatchURL: stringPtr(request.PatchURL),
|
||||
Comments: intPtr(request.Comments),
|
||||
Assignee: convertUser(request.Assignee),
|
||||
Assignees: convertUsers(request.Assignees),
|
||||
Milestone: convertMilestone(request.Milestone),
|
||||
Labels: convertLabels(request.Labels),
|
||||
}
|
||||
|
||||
// Convert PR branch info
|
||||
if request.Head != nil {
|
||||
pr.Head = convertPRBranch(request.Head)
|
||||
}
|
||||
if request.Base != nil {
|
||||
pr.Base = convertPRBranch(request.Base)
|
||||
}
|
||||
|
||||
return pr
|
||||
}
|
||||
|
||||
func convertCorePullRequest(request *structs.PullRequest) *github.PullRequest {
|
||||
if request == nil {
|
||||
return &github.PullRequest{}
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ func convertPullRequestEvent(event *structs.PullRequestPayload) *github.PullRequ
|
|||
|
||||
return &github.PullRequestEvent{
|
||||
Action: stringPtr(translatePrAction(event.Action, false)),
|
||||
PullRequest: convertPullRequest(event.PullRequest),
|
||||
PullRequest: convertCorePullRequest(event.PullRequest),
|
||||
Repo: convertCoreRepo(event.Repository),
|
||||
Assignee: convertCoreUser(event.PullRequest.Assignee),
|
||||
Number: intPtr(int(event.Index)),
|
||||
|
|
Loading…
Reference in New Issue