From a298d3bfc152cee25eeea45ce883c92c01df9699 Mon Sep 17 00:00:00 2001 From: tison Date: Fri, 19 Jan 2024 09:47:20 +0800 Subject: [PATCH] chore: simplify reviewer candidates logic (#4017) Signed-off-by: tison --- .github/CODEOWNERS | 5 ---- .github/scripts/assign_reviewers.js | 36 ++++++++++++++--------------- 2 files changed, 17 insertions(+), 24 deletions(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index a4a3ce291f1f..57cae2979696 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -8,8 +8,3 @@ /bindings/nodejs/ @suyanhanx /bindings/python/ @messense @Zheaoli /bindings/ruby/ @PsiACE - -# This is a place holder for all committers who what to join the review of not owned code. -# -# More details could be found at -COMMITTERS_PLACEHOLDER @Xuanwo @Ji-Xinyou @morristai @dqhl76 @ClSlaid @Young-Flash @G-XD @oowl @silver-ymz diff --git a/.github/scripts/assign_reviewers.js b/.github/scripts/assign_reviewers.js index 15089ba90568..0d65fc5eed83 100644 --- a/.github/scripts/assign_reviewers.js +++ b/.github/scripts/assign_reviewers.js @@ -17,33 +17,31 @@ * under the License. */ +// All committers who what to join the review of not owned code. +// More details could be found at https://github.com/apache/opendal/issues/3967. +const candidates = [ + "Xuanwo", + "Ji-Xinyou", + "morristai", + "dqhl76", + "ClSlaid", + "Young-Flash", + "G-XD", + "oowl", + "silver-ymz", +]; + async function run(github, context, core, fs) { try { // Pick two reviewers from list const numberOfReviewers = 2; const repo = context.repo; - // Read CODEOWNERS - const codeownersContent = fs.readFileSync('.github/CODEOWNERS', 'utf8'); - const lines = codeownersContent.split('\n'); - - // Search COMMITTERS - const placeholderLine = lines.find(line => line.startsWith('COMMITTERS_PLACEHOLDER')); - if (!placeholderLine) { - throw new Error("No COMMITTERS found in CODEOWNERS"); - } - - // Extract committers from placeholder line - const committers = placeholderLine.match(/@[\w-]+/g).map(u => u.substring(1)); - if (committers.length === 0) { - throw new Error("No committer found in COMMITTERS_PLACEHOLDER"); - } - // Pick reviewers const selectedReviewers = []; - while (selectedReviewers.length < numberOfReviewers && committers.length > 0) { - const randomIndex = Math.floor(Math.random() * committers.length); - selectedReviewers.push(committers.splice(randomIndex, 1)[0]); + while (selectedReviewers.length < numberOfReviewers && candidates.length > 0) { + const randomIndex = Math.floor(Math.random() * candidates.length); + selectedReviewers.push(candidates.splice(randomIndex, 1)[0]); } // Assign reviewers Pull Request