diff --git a/.ci/magician/cmd/request_reviewer_test.go b/.ci/magician/cmd/request_reviewer_test.go index f40288ddb2ab..b2af19be6b2d 100644 --- a/.ci/magician/cmd/request_reviewer_test.go +++ b/.ci/magician/cmd/request_reviewer_test.go @@ -25,6 +25,9 @@ import ( func TestExecRequestReviewer(t *testing.T) { availableReviewers := github.AvailableReviewers() + if len(availableReviewers) < 3 { + t.Fatalf("not enough available reviewers (%v) to run TestExecRequestReviewer (need at least 3)", availableReviewers) + } cases := map[string]struct { pullRequest github.PullRequest requestedReviewers []string diff --git a/.ci/magician/github/membership.go b/.ci/magician/github/membership.go index c627cc14624a..d3694ccd7255 100644 --- a/.ci/magician/github/membership.go +++ b/.ci/magician/github/membership.go @@ -24,97 +24,6 @@ import ( "golang.org/x/exp/maps" ) -var ( - // This is for the random-assignee rotation. - reviewerRotation = map[string]struct{}{ - "slevenick": struct{}{}, - "c2thorn": struct{}{}, - "rileykarson": struct{}{}, - "melinath": struct{}{}, - "ScottSuarez": struct{}{}, - "shuyama1": struct{}{}, - "SarahFrench": struct{}{}, - "roaks3": struct{}{}, - "zli82016": struct{}{}, - "trodge": struct{}{}, - "hao-nan-li": struct{}{}, - "NickElliot": struct{}{}, - "BBBmau": struct{}{}, - } - - // This is for new team members who are onboarding - trustedContributors = map[string]struct{}{} - - // This is for reviewers who are "on vacation": will not receive new review assignments but will still receive re-requests for assigned PRs. - // User can specify the time zone like this, and following the example below: - pdtLoc, _ = time.LoadLocation("America/Los_Angeles") - bstLoc, _ = time.LoadLocation("Europe/London") - onVacationReviewers = []onVacationReviewer{ - // Example: taking vacation from 2024-03-28 to 2024-04-02 in pdt time zone. - // both ends are inclusive: - // { - // id: "xyz", - // startDate: newDate(2024, 3, 28, pdtLoc), - // endDate: newDate(2024, 4, 2, pdtLoc), - // }, - { - id: "hao-nan-li", - startDate: newDate(2024, 4, 11, pdtLoc), - endDate: newDate(2024, 6, 14, pdtLoc), - }, - { - id: "ScottSuarez", - startDate: newDate(2024, 4, 30, pdtLoc), - endDate: newDate(2024, 7, 31, pdtLoc), - }, - { - id: "SarahFrench", - startDate: newDate(2024, 8, 2, bstLoc), - endDate: newDate(2024, 8, 6, bstLoc), - }, - { - id: "shuyama1", - startDate: newDate(2024, 5, 22, pdtLoc), - endDate: newDate(2024, 5, 28, pdtLoc), - }, - { - id: "melinath", - startDate: newDate(2024, 6, 26, pdtLoc), - endDate: newDate(2024, 7, 22, pdtLoc), - }, - { - id: "slevenick", - startDate: newDate(2024, 7, 5, pdtLoc), - endDate: newDate(2024, 7, 16, pdtLoc), - }, - { - id: "c2thorn", - startDate: newDate(2024, 7, 10, pdtLoc), - endDate: newDate(2024, 7, 16, pdtLoc), - }, - { - id: "rileykarson", - startDate: newDate(2024, 7, 18, pdtLoc), - endDate: newDate(2024, 8, 10, pdtLoc), - }, - { - id: "roaks3", - startDate: newDate(2024, 8, 2, pdtLoc), - endDate: newDate(2024, 8, 9, pdtLoc), - }, - { - id: "slevenick", - startDate: newDate(2024, 8, 10, pdtLoc), - endDate: newDate(2024, 8, 17, pdtLoc), - }, - { - id: "trodge", - startDate: newDate(2024, 8, 24, pdtLoc), - endDate: newDate(2024, 9, 2, pdtLoc), - }, - } -) - type UserType int64 type date struct { diff --git a/.ci/magician/github/membership_data.go b/.ci/magician/github/membership_data.go new file mode 100644 index 000000000000..7b8f2964faee --- /dev/null +++ b/.ci/magician/github/membership_data.go @@ -0,0 +1,94 @@ +package github + +import "time" + +var ( + // This is for the random-assignee rotation. + reviewerRotation = map[string]struct{}{ + "slevenick": {}, + "c2thorn": {}, + "rileykarson": {}, + "melinath": {}, + "ScottSuarez": {}, + "shuyama1": {}, + "SarahFrench": {}, + "roaks3": {}, + "zli82016": {}, + "trodge": {}, + "hao-nan-li": {}, + "NickElliot": {}, + "BBBmau": {}, + } + + // This is for new team members who are onboarding + trustedContributors = map[string]struct{}{} + + // This is for reviewers who are "on vacation": will not receive new review assignments but will still receive re-requests for assigned PRs. + // User can specify the time zone like this, and following the example below: + pdtLoc, _ = time.LoadLocation("America/Los_Angeles") + bstLoc, _ = time.LoadLocation("Europe/London") + onVacationReviewers = []onVacationReviewer{ + // Example: taking vacation from 2024-03-28 to 2024-04-02 in pdt time zone. + // both ends are inclusive: + // { + // id: "xyz", + // startDate: newDate(2024, 3, 28, pdtLoc), + // endDate: newDate(2024, 4, 2, pdtLoc), + // }, + { + id: "hao-nan-li", + startDate: newDate(2024, 4, 11, pdtLoc), + endDate: newDate(2024, 6, 14, pdtLoc), + }, + { + id: "ScottSuarez", + startDate: newDate(2024, 4, 30, pdtLoc), + endDate: newDate(2024, 7, 31, pdtLoc), + }, + { + id: "SarahFrench", + startDate: newDate(2024, 8, 2, bstLoc), + endDate: newDate(2024, 8, 6, bstLoc), + }, + { + id: "shuyama1", + startDate: newDate(2024, 5, 22, pdtLoc), + endDate: newDate(2024, 5, 28, pdtLoc), + }, + { + id: "melinath", + startDate: newDate(2024, 6, 26, pdtLoc), + endDate: newDate(2024, 7, 22, pdtLoc), + }, + { + id: "slevenick", + startDate: newDate(2024, 7, 5, pdtLoc), + endDate: newDate(2024, 7, 16, pdtLoc), + }, + { + id: "c2thorn", + startDate: newDate(2024, 7, 10, pdtLoc), + endDate: newDate(2024, 7, 16, pdtLoc), + }, + { + id: "rileykarson", + startDate: newDate(2024, 7, 18, pdtLoc), + endDate: newDate(2024, 8, 10, pdtLoc), + }, + { + id: "roaks3", + startDate: newDate(2024, 8, 2, pdtLoc), + endDate: newDate(2024, 8, 9, pdtLoc), + }, + { + id: "slevenick", + startDate: newDate(2024, 8, 10, pdtLoc), + endDate: newDate(2024, 8, 17, pdtLoc), + }, + { + id: "trodge", + startDate: newDate(2024, 8, 24, pdtLoc), + endDate: newDate(2024, 9, 2, pdtLoc), + }, + } +) diff --git a/.ci/magician/github/reviewer_assignment_test.go b/.ci/magician/github/reviewer_assignment_test.go index ad85f5232c32..6a2cb33b6a25 100644 --- a/.ci/magician/github/reviewer_assignment_test.go +++ b/.ci/magician/github/reviewer_assignment_test.go @@ -24,6 +24,9 @@ import ( ) func TestChooseCoreReviewers(t *testing.T) { + if len(AvailableReviewers()) < 2 { + t.Fatalf("not enough available reviewers (%v) to test (need at least 2)", AvailableReviewers()) + } firstCoreReviewer := AvailableReviewers()[0] secondCoreReviewer := AvailableReviewers()[1] cases := map[string]struct { diff --git a/.github/workflows/request-reviewer.yml b/.github/workflows/request-reviewer.yml index 45c5ffacd4e6..7748d32f8e04 100644 --- a/.github/workflows/request-reviewer.yml +++ b/.github/workflows/request-reviewer.yml @@ -24,6 +24,8 @@ jobs: steps: - name: Checkout Repository uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.2 + with: + ref: main - name: Set up Go uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 with: