Merge pull request #1431 from merico-dev/fix-pr-lack-author
fix(github): add columns to pull_request
diff --git a/models/domainlayer/code/pull_request.go b/models/domainlayer/code/pull_request.go
index 421a1d7..676e06f 100644
--- a/models/domainlayer/code/pull_request.go
+++ b/models/domainlayer/code/pull_request.go
@@ -11,7 +11,10 @@
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 a787ab4..ee40d97 100644
--- a/plugins/github/github.go
+++ b/plugins/github/github.go
@@ -449,17 +449,17 @@
//"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 b65f3e2..5bc3a0b 100644
--- a/plugins/github/models/github_pull_request.go
+++ b/plugins/github/models/github_pull_request.go
@@ -31,5 +31,8 @@
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 77f0d78..b02399f 100644
--- a/plugins/github/tasks/github_pull_request_collector.go
+++ b/plugins/github/tasks/github_pull_request_collector.go
@@ -20,6 +20,7 @@
State string
Title string
Body string
+ Url string
Labels []struct {
Name string `json:"name"`
} `json:"labels"`
@@ -27,6 +28,10 @@
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 @@
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 543798c..f6646de 100644
--- a/plugins/github/tasks/github_pull_request_converter.go
+++ b/plugins/github/tasks/github_pull_request_converter.go
@@ -39,6 +39,10 @@
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,