From 8a886950157b206977b0280758d56f617a6bba84 Mon Sep 17 00:00:00 2001 From: Oleg Bespalov Date: Tue, 5 Dec 2023 13:32:17 +0100 Subject: [PATCH] Assign pull-requests via CODEOWNERS --- .github/workflows/pr-auto-assign.yml | 37 ---------------------------- CODEOWNERS | 2 ++ 2 files changed, 2 insertions(+), 37 deletions(-) delete mode 100644 .github/workflows/pr-auto-assign.yml create mode 100644 CODEOWNERS diff --git a/.github/workflows/pr-auto-assign.yml b/.github/workflows/pr-auto-assign.yml deleted file mode 100644 index 26359e87f4d..00000000000 --- a/.github/workflows/pr-auto-assign.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: "Auto assign PR reviewers" -on: - pull_request_target: - types: [opened, ready_for_review, reopened] - -permissions: - pull-requests: write - -jobs: - add-reviews: - if: ${{ join(github.event.pull_request.requested_reviewers.*.login, ',') == '' && github.event.pull_request.draft == false }} - runs-on: ubuntu-latest - steps: - - uses: actions/github-script@v6 - with: - script: | - const reviewers = ['mstoykov', 'codebien', 'olegbespalov', 'oleiade', 'joanlopez']; - const reviewerCount = 2; - const crypto = require("node:crypto"); - - const getNRandom = (n, array) => { - let result = new Array(); - for (;n > 0 && array.length > 0; n--) { - const chosen = array[crypto.randomInt(array.length)]; - result.push(chosen); - array = array.filter(el => el != chosen); - } - return result; - } - const reviewersWithoutAuthor = reviewers.filter(user => user !== context.payload.pull_request.user.login); - - github.rest.pulls.requestReviewers({ - owner: context.repo.owner, - repo: context.repo.repo, - pull_number: context.payload.pull_request.number, - reviewers: getNRandom(reviewerCount, reviewersWithoutAuthor), - }); diff --git a/CODEOWNERS b/CODEOWNERS new file mode 100644 index 00000000000..8930de14a4a --- /dev/null +++ b/CODEOWNERS @@ -0,0 +1,2 @@ +# by default the k6-core team is the owner of all files +* @grafana/k6-core