Skip to content

[WIP - no merge] Update add label based on code owners #1772

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
38 changes: 5 additions & 33 deletions .github/workflows/AddLabel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,32 +50,6 @@ jobs:
console.log("This workflow is running within an invalid context")
process.exit(1)
}

// This list should match with CODEOWNERS.
let requiredReviewers = {
gobbleturk: "",
khatwanimohit: "",
bvandermoon: "",
vipannalla: "",
RissyRan: "",
richjames0: "",
rni418: "",
gagika: "",
shralex: "",
yangyuwei: "",
SurbhiJainUSC: "",
hengtaoguo: "",
A9isha: "",
wang2yn84: "",
wyzhang: "",
mitalisi: "",
gpolovets1: "",
mailvijayasingh: "",
jrplatin: "",
patemotter: "",
lumosis: "",
aireenmei: "",
}
const reviews = await github.rest.pulls.listReviews({
owner,
repo,
Expand All @@ -93,14 +67,12 @@ jobs:
console.log("Not adding pull ready because the PR is not approved yet.")
process.exit()
}
let num_approved = 0
for (const review of reviews.data) {
if (review.state === "APPROVED" && review.user.login in requiredReviewers) {
num_approved = num_approved + 1
}
let is_approved = false
if (pullRequest.state === "APPROVED") {
is_approved = true
}
if (num_approved < 2) {
console.log("Not adding pull ready because the PR is not approved yet by 2 code owners.")
if (!is_approved) {
console.log("Not adding pull ready because the PR is not approved yet by sufficient code owners.")
process.exit()
}

Expand Down
Loading