Show PR CI status #306
|
@ -24,7 +24,7 @@ func PullDetails(pr *gitea.PullRequest, reviews []*gitea.PullReview) {
|
|||
}
|
||||
|
||||
noerw marked this conversation as resolved
Outdated
|
||||
out := fmt.Sprintf(
|
||||
"# #%d %s (%s)\n@%s created %s\t**%s** <- **%s**\n\n%s\n",
|
||||
"# #%d %s (%s)\n@%s created %s\t**%s** <- **%s**\n\n%s\n\n",
|
||||
pr.Index,
|
||||
pr.Title,
|
||||
pr.State,
|
||||
|
@ -36,23 +36,28 @@ func PullDetails(pr *gitea.PullRequest, reviews []*gitea.PullReview) {
|
|||
)
|
||||
|
||||
if len(reviews) != 0 {
|
||||
out += "\n"
|
||||
revMap := make(map[string]gitea.ReviewStateType)
|
||||
out += "---\n"
|
||||
revMap := make(map[gitea.ReviewStateType][]string)
|
||||
for _, review := range reviews {
|
||||
switch review.State {
|
||||
case gitea.ReviewStateApproved,
|
||||
gitea.ReviewStateRequestChanges,
|
||||
gitea.ReviewStateRequestReview:
|
||||
revMap[review.Reviewer.UserName] = review.State
|
||||
6543 marked this conversation as resolved
Outdated
6543
commented
this remove dedublicate review states!! before:
now:
I like the new look, but you still have to only get latest state for each user this remove dedublicate review states!!
before:
```
@lunny: APPROVED @6543: APPROVED
```
now:
```md
* REQUEST_REVIEW by @lunny, @6543
* APPROVED by @lunny, @lunny, @6543
```
I like the new look, but you still have to only get latest state for each user
6543
commented
example was: example was: `tea pr 309`
noerw
commented
Oh right. And I thought I was fixing a bug: Thought you were aiming to deduplicate Approved/Rejected states. IMO we should deduplicate both. I just tried to filter by Oh right. And I thought I was fixing a bug: Thought you were aiming to deduplicate Approved/Rejected states. IMO we should deduplicate both.
I just tried to filter by `review.Stale`, but that's never true. wtf is this for?
6543
commented
Stale is a idication if the review took place on a different state as the pull is now (pull diff has changed since reviewed) Stale is a idication if the review took place on a different state as the pull is now (pull diff has changed since reviewed)
noerw
commented
fixed, output is now
fixed, output is now
```
• APPROVED by @lunny, @6543
```
|
||||
u := revMap[review.State]
|
||||
revMap[review.State] = append(u, review.Reviewer.UserName)
|
||||
}
|
||||
}
|
||||
for k, v := range revMap {
|
||||
out += fmt.Sprintf("\n @%s: %s", k, v)
|
||||
out += fmt.Sprintf("- %s by @%s\n", k, strings.Join(v, ", @"))
|
||||
}
|
||||
}
|
||||
|
||||
if pr.State == gitea.StateOpen && pr.Mergeable {
|
||||
out += "\nNo Conflicts"
|
||||
if pr.State == gitea.StateOpen {
|
||||
if pr.Mergeable {
|
||||
out += "\nNo Conflicts"
|
||||
} else {
|
||||
out += "\nConflicting files"
|
||||
}
|
||||
}
|
||||
|
||||
outputMarkdown(out)
|
||||
|
|
Loading…
Reference in New Issue
Block a user
Pull wip?