Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vacation pr review blocking #11

Merged
merged 7 commits into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .ci/magician/cmd/request_reviewer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
91 changes: 0 additions & 91 deletions .ci/magician/github/membership.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
94 changes: 94 additions & 0 deletions .ci/magician/github/membership_data.go
Original file line number Diff line number Diff line change
@@ -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),
},
}
)
3 changes: 3 additions & 0 deletions .ci/magician/github/reviewer_assignment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/request-reviewer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ jobs:
steps:
- name: Checkout Repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.2
- name: Checkout membership data from main branch
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.2
with:
ref: main
path: .
sparse-checkout: |
.ci/magician/github/membership_data.go
sparse-checkout-cone-mode: false
- name: Set up Go
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
with:
Expand Down
Loading