diff --git a/models/domainlayer/code/pull_request.go b/models/domainlayer/code/pull_request.go index 421a1d78623..676e06f3858 100644 --- a/models/domainlayer/code/pull_request.go +++ b/models/domainlayer/code/pull_request.go @@ -11,7 +11,10 @@ type PullRequest struct { RepoId string `gorm:"index"` Status string `gorm:"comment:open/closed or other"` Title string + Description string Url string + AuthorName string + AuthorId int Key int CreatedDate time.Time MergedDate *time.Time diff --git a/plugins/github/github.go b/plugins/github/github.go index a787ab47230..ee40d97fc88 100644 --- a/plugins/github/github.go +++ b/plugins/github/github.go @@ -449,17 +449,17 @@ func main() { //"collectIssues", //"collectIssueEvents", //"collectIssueComments", - //"collectPullRequests", + "collectPullRequests", //"collectPullRequestReviews", //"collectPullRequestCommits", - "enrichIssues", + //"enrichIssues", //"enrichPullRequests", //"enrichComments", //"enrichPullRequestIssues", //"convertRepos", //"convertIssues", //"convertIssueLabels", - //"convertPullRequests", + "convertPullRequests", //"convertCommits", //"convertPullRequestCommits", //"convertPullRequestLabels", diff --git a/plugins/github/models/github_pull_request.go b/plugins/github/models/github_pull_request.go index b65f3e200a4..5bc3a0b3ccb 100644 --- a/plugins/github/models/github_pull_request.go +++ b/plugins/github/models/github_pull_request.go @@ -31,5 +31,8 @@ type GithubPullRequest struct { BaseRef string BaseCommitSha string HeadCommitSha string + Url string + AuthorName string + AuthorId int common.NoPKModel } diff --git a/plugins/github/tasks/github_pull_request_collector.go b/plugins/github/tasks/github_pull_request_collector.go index 77f0d78b135..b02399fab52 100644 --- a/plugins/github/tasks/github_pull_request_collector.go +++ b/plugins/github/tasks/github_pull_request_collector.go @@ -20,6 +20,7 @@ type GithubApiPullRequest struct { State string Title string Body string + Url string Labels []struct { Name string `json:"name"` } `json:"labels"` @@ -27,6 +28,10 @@ type GithubApiPullRequest struct { Login string Id int } + User *struct { + Id int + Login string + } ClosedAt *core.Iso8601Time `json:"closed_at"` MergedAt *core.Iso8601Time `json:"merged_at"` GithubCreatedAt core.Iso8601Time `json:"created_at"` @@ -108,6 +113,9 @@ func convertGithubPullRequest(pull *GithubApiPullRequest, repoId int) (*models.G Number: pull.Number, State: pull.State, Title: pull.Title, + Url: pull.Url, + AuthorName: pull.User.Login, + AuthorId: pull.User.Id, GithubCreatedAt: pull.GithubCreatedAt.ToTime(), GithubUpdatedAt: core.Iso8601TimeToTime(pull.GithubUpdatedAt), ClosedAt: core.Iso8601TimeToTime(pull.ClosedAt), diff --git a/plugins/github/tasks/github_pull_request_converter.go b/plugins/github/tasks/github_pull_request_converter.go index 543798cf7e3..f6646dee02d 100644 --- a/plugins/github/tasks/github_pull_request_converter.go +++ b/plugins/github/tasks/github_pull_request_converter.go @@ -39,6 +39,10 @@ func ConvertPullRequests(ctx context.Context, repoId int) error { RepoId: domainRepoIdGenerator.Generate(pr.RepoId), Status: pr.State, Title: pr.Title, + Description: pr.Body, + Url: pr.Url, + AuthorName: pr.AuthorName, + AuthorId: pr.AuthorId, CreatedDate: pr.GithubCreatedAt, MergedDate: pr.MergedAt, ClosedAt: pr.ClosedAt,