feat: Add function to get reviews per PR

Signed-off-by: Matej Focko <me@mfocko.xyz>
This commit is contained in:
Matej Focko 2021-05-12 15:45:22 +02:00
parent 8ffd5ca8eb
commit 4c3fcd20e4
No known key found for this signature in database
GPG key ID: CD9628474574E0B6

12
main.go
View file

@ -117,6 +117,18 @@ func patchFiles(wrapper *wrap.Wrapper, commentsByFile map[string]([]*gitea.PullR
}
}
func GetReviewsPerPR(client *gitea.Client, prID int64) []int64 {
reviews, _, err := client.ListPullReviews(REPOSITORY_OWNER, REPOSITORY_NAME, prID, gitea.ListPullReviewsOptions{})
ExitOnError(err)
result := make([]int64, 0)
for _, review := range reviews {
result = append(result, review.ID)
}
return result
}
func main() {
token := os.Getenv("GITEA_TOKEN")