neovim/.github/scripts/remove-reviewers.js
dundargoc ef95174694
ci: add team reviewers (#21434)
Using team reviewers when possible reduces the churn on the git history
as we'll be able to add or remove reviewers without needing to change
the workflow files.

This requires using Github fine-grained personal access tokens with Pull
Requests set to "Read and write" and Members to "Read-only".
2022-12-15 20:40:30 +01:00

19 lines
588 B
JavaScript

module.exports = async ({github, context}) => {
const requestedReviewers = await github.rest.pulls.listRequestedReviewers({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number
});
const reviewers = requestedReviewers.data.users.map(e => e.login)
const team_reviewers = requestedReviewers.data.teams.map(e => e.name);
github.rest.pulls.removeRequestedReviewers({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number,
reviewers: reviewers,
team_reviewers: team_reviewers
});
}