Skip to content

Commit

Permalink
Dedupe reviewers before submitting them to GitHub (#856)
Browse files Browse the repository at this point in the history
Co-authored-by: Max Schwenk <[email protected]>
  • Loading branch information
FraBle and maschwenk authored Oct 3, 2024
1 parent 5641eea commit 2c98d7d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions server/handler/eval_context_reviewers.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package handler
import (
"context"
"math/rand"
"slices"
"time"

"github.com/google/go-github/v65/github"
Expand Down Expand Up @@ -151,5 +152,11 @@ func selectionToReviewersRequest(s reviewer.Selection) github.ReviewersRequest {
req.TeamReviewers = []string{}
}

// Order the reviewers and remove any duplicates because the Github API will error on duplicates as of Oct 2024
slices.Sort(req.Reviewers)
req.Reviewers = slices.Compact(req.Reviewers)
slices.Sort(req.TeamReviewers)
req.TeamReviewers = slices.Compact(req.TeamReviewers)

return req
}

0 comments on commit 2c98d7d

Please sign in to comment.