Skip to content

Commit

Permalink
Show PRs that dont require review as 'Mergeable' in reviews list. (#6422
Browse files Browse the repository at this point in the history
)
  • Loading branch information
jdhollen authored Apr 23, 2024
1 parent a187ccf commit 5c3630a
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 17 deletions.
3 changes: 2 additions & 1 deletion enterprise/app/review/review.css
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@
background-color: #ffc107;
}

.reviews .pr-status-approved:before {
.reviews .pr-status-approved:before,
.reviews .pr-status-mergeable:before {
background-color: #4caf50;
}

Expand Down
2 changes: 2 additions & 0 deletions enterprise/app/review/review_list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,8 @@ class PR extends React.Component<PRProps> {
status = "unresolved";
} else if (approved) {
status = "approved";
} else if (this.props.pr.mergeable) {
status = "mergeable";
}

return (
Expand Down
34 changes: 18 additions & 16 deletions enterprise/server/githubapp/githubapp.go
Original file line number Diff line number Diff line change
Expand Up @@ -2397,22 +2397,23 @@ func (a *GitHubApp) GetGithubPullRequestDetails(ctx context.Context, req *ghpb.G
}

type searchPR struct {
Title string
TitleHTML string `graphql:"titleHTML"`
Body string
BodyHTML string `graphql:"bodyHTML"`
Author actor
CreatedAt time.Time
Id string
Number int
UpdatedAt time.Time
Merged bool
URL string `graphql:"url"`
HeadRefName string
Additions int
Deletions int
ChangedFiles int
Repository struct {
Title string
TitleHTML string `graphql:"titleHTML"`
Body string
BodyHTML string `graphql:"bodyHTML"`
Author actor
CreatedAt time.Time
Id string
Number int
UpdatedAt time.Time
MergeStateStatus string
Merged bool
URL string `graphql:"url"`
HeadRefName string
Additions int
Deletions int
ChangedFiles int
Repository struct {
Name string
Owner struct {
Login string
Expand Down Expand Up @@ -2555,6 +2556,7 @@ func issueToPullRequestProto(i *searchPR, requestedUser string) *ghpb.PullReques
Additions: int64(i.Additions),
Deletions: int64(i.Deletions),
ChangedFiles: int64(i.ChangedFiles),
Mergeable: i.MergeStateStatus == "CLEAN",
}
for _, r := range i.ReviewRequests.Nodes {
review, ok := p.Reviews[r.RequestedReviewer.User.Login]
Expand Down
1 change: 1 addition & 0 deletions proto/github.proto
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,7 @@ message PullRequest {
int64 additions = 8;
int64 deletions = 9;
int64 changed_files = 10;
bool mergeable = 13;
}

message Review {
Expand Down

0 comments on commit 5c3630a

Please sign in to comment.