Skip to content

Commit

Permalink
Added extra logging to bot assignment.
Browse files Browse the repository at this point in the history
  • Loading branch information
russjones committed Dec 3, 2021
1 parent beb91db commit 0e96258
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 234 deletions.
234 changes: 0 additions & 234 deletions .github/workflows/ci/pkg/environment/environment_test.go

This file was deleted.

3 changes: 3 additions & 0 deletions .github/workflows/robot/internal/bot/assign.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package bot

import (
"context"
"log"

"github.com/gravitational/trace"
)
Expand All @@ -33,6 +34,8 @@ func (b *Bot) Assign(ctx context.Context) error {
return trace.Wrap(err)
}

log.Printf("Assign: Requesting reviews from: %v.", reviewers)

// Request GitHub assign reviewers to this PR.
err = b.c.GitHub.RequestReviewers(ctx,
b.c.Environment.Organization,
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/robot/internal/review/review.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package review

import (
"encoding/json"
"log"
"math/rand"
"time"

Expand Down Expand Up @@ -124,14 +125,18 @@ func (r *Assignments) Get(author string, docs bool, code bool) []string {

switch {
case docs && code:
log.Printf("Assign: Found docs and code changes.")
reviewers = append(reviewers, r.getDocsReviewers(author)...)
reviewers = append(reviewers, r.getCodeReviewers(author)...)
case !docs && code:
log.Printf("Assign: Found code changes.")
reviewers = append(reviewers, r.getCodeReviewers(author)...)
case docs && !code:
log.Printf("Assign: Found docs changes.")
reviewers = append(reviewers, r.getDocsReviewers(author)...)
// Strange state, an empty commit? Return admin reviewers.
case !docs && !code:
log.Printf("Assign: Found no docs or code changes.")
reviewers = append(reviewers, r.getAdminReviewers(author)...)
}

Expand Down

0 comments on commit 0e96258

Please sign in to comment.