Update grpc #937
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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), | |
}); |