Skip to content

Commit

Permalink
bot: Add teleport-private repo (#223)
Browse files Browse the repository at this point in the history
  • Loading branch information
jimbishopp authored Feb 10, 2024
1 parent 111ec9c commit 67275c5
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions bot/internal/review/review.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,12 +235,12 @@ func (r *Assignments) Get(e *env.Environment, changes env.Changes, files []githu
return reviewers
}

func (r *Assignments) repoReviewers(repo string) map[string]Reviewer {
switch repo {
case env.TeleportRepo, env.TeleportERepo:
return r.c.CoreReviewers
case env.CloudRepo:
func (r *Assignments) repoReviewers(e *env.Environment) map[string]Reviewer {
switch e.RepoOwnerTeam() {
case env.CloudTeam:
return r.c.CloudReviewers
case env.CoreTeam:
return r.c.CoreReviewers
}
return map[string]Reviewer{}
}
Expand All @@ -252,7 +252,7 @@ func (r *Assignments) getReleaseReviewers() []string {
func (r *Assignments) getDocsReviewers(e *env.Environment, files []github.PullRequestFile) []string {
// See if any code reviewers are designated preferred reviewers for one of
// the changed docs files. If so, add them as docs reviewers.
repoReviewers := r.repoReviewers(e.Repository)
repoReviewers := r.repoReviewers(e)
a, b := getReviewerSets(e.Author, repoReviewers, r.c.CodeReviewersOmit)
prefCodeReviewers := r.getAllPreferredReviewers(repoReviewers, append(a, b...), files)

Expand All @@ -270,7 +270,7 @@ func (r *Assignments) getDocsReviewers(e *env.Environment, files []github.PullRe
}

func (r *Assignments) getCodeReviewers(e *env.Environment, files []github.PullRequestFile) []string {
reviewers := r.repoReviewers(e.Repository)
reviewers := r.repoReviewers(e)

// Obtain full sets of reviewers.
setA, setB := r.getCodeReviewerSets(e)
Expand Down Expand Up @@ -392,7 +392,7 @@ func (r *Assignments) getCodeReviewerSets(e *env.Environment) ([]string, []strin
n := len(reviewers) / 2
return reviewers[:n], reviewers[n:]
}
return getReviewerSets(e.Author, r.repoReviewers(e.Repository), r.c.CodeReviewersOmit)
return getReviewerSets(e.Author, r.repoReviewers(e), r.c.CodeReviewersOmit)
}

// CheckExternal requires two admins have approved.
Expand Down Expand Up @@ -492,7 +492,7 @@ func (r *Assignments) checkInternalDocsReviews(e *env.Environment, reviews []git
// checkInternalCodeReviews checks whether code review requirements are satisfied
// for a PR authored by an internal employee
func (r *Assignments) checkInternalCodeReviews(e *env.Environment, changes env.Changes, reviews []github.Review) error {
setA, setB := getReviewerSets(e.Author, r.repoReviewers(e.Repository), r.c.CodeReviewersOmit)
setA, setB := getReviewerSets(e.Author, r.repoReviewers(e), r.c.CodeReviewersOmit)

// PRs can be approved if you either have multiple code owners that approve
// or code owner and code reviewer. An exception is for PRs that
Expand Down

0 comments on commit 67275c5

Please sign in to comment.