Skip to content

Commit e489c96

Browse files
committed
Update add label rule
1 parent d702bfc commit e489c96

File tree

1 file changed

+5
-33
lines changed

1 file changed

+5
-33
lines changed

.github/workflows/AddLabel.yml

Lines changed: 5 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -50,32 +50,6 @@ jobs:
5050
console.log("This workflow is running within an invalid context")
5151
process.exit(1)
5252
}
53-
54-
// This list should match with CODEOWNERS.
55-
let requiredReviewers = {
56-
gobbleturk: "",
57-
khatwanimohit: "",
58-
bvandermoon: "",
59-
vipannalla: "",
60-
RissyRan: "",
61-
richjames0: "",
62-
rni418: "",
63-
gagika: "",
64-
shralex: "",
65-
yangyuwei: "",
66-
SurbhiJainUSC: "",
67-
hengtaoguo: "",
68-
A9isha: "",
69-
wang2yn84: "",
70-
wyzhang: "",
71-
mitalisi: "",
72-
gpolovets1: "",
73-
mailvijayasingh: "",
74-
jrplatin: "",
75-
patemotter: "",
76-
lumosis: "",
77-
aireenmei: "",
78-
}
7953
const reviews = await github.rest.pulls.listReviews({
8054
owner,
8155
repo,
@@ -93,14 +67,12 @@ jobs:
9367
console.log("Not adding pull ready because the PR is not approved yet.")
9468
process.exit()
9569
}
96-
let num_approved = 0
97-
for (const review of reviews.data) {
98-
if (review.state === "APPROVED" && review.user.login in requiredReviewers) {
99-
num_approved = num_approved + 1
100-
}
70+
let is_approved = false
71+
if (pullRequest.state === "APPROVED") {
72+
is_approved = true
10173
}
102-
if (num_approved < 2) {
103-
console.log("Not adding pull ready because the PR is not approved yet by 2 code owners.")
74+
if (!is_approved) {
75+
console.log("Not adding pull ready because the PR is not approved yet by sufficient code owners.")
10476
process.exit()
10577
}
10678

0 commit comments

Comments
 (0)