2022-02-13 15:15:20 -07:00
|
|
|
module.exports = async ({github, context}) => {
|
|
|
|
const pr_data = await github.rest.pulls.get({
|
|
|
|
owner: context.repo.owner,
|
|
|
|
repo: context.repo.repo,
|
|
|
|
pull_number: context.issue.number
|
|
|
|
})
|
|
|
|
const labels = pr_data.data.labels.map(e => e.name)
|
|
|
|
|
|
|
|
const reviewers = new Set()
|
2022-12-15 12:40:30 -07:00
|
|
|
const team_reviewers = new Array()
|
2022-02-13 15:15:20 -07:00
|
|
|
if (labels.includes('api')) {
|
|
|
|
reviewers.add("bfredl")
|
|
|
|
}
|
|
|
|
|
2022-03-04 03:28:32 -07:00
|
|
|
if (labels.includes('build')) {
|
2023-04-02 08:37:05 -07:00
|
|
|
team_reviewers.push('ci');
|
2022-03-04 03:28:32 -07:00
|
|
|
}
|
|
|
|
|
2022-02-13 15:15:20 -07:00
|
|
|
if (labels.includes('ci')) {
|
2022-12-15 12:40:30 -07:00
|
|
|
team_reviewers.push('ci');
|
2022-02-13 15:15:20 -07:00
|
|
|
}
|
|
|
|
|
2022-02-14 10:35:40 -07:00
|
|
|
if (labels.includes('column')) {
|
|
|
|
reviewers.add("lewis6991")
|
|
|
|
}
|
|
|
|
|
2022-11-30 06:19:11 -07:00
|
|
|
if (labels.includes('dependencies')) {
|
|
|
|
reviewers.add("jamessan")
|
|
|
|
}
|
|
|
|
|
2022-02-13 15:15:20 -07:00
|
|
|
if (labels.includes('diagnostic')) {
|
|
|
|
reviewers.add("gpanders")
|
|
|
|
}
|
|
|
|
|
2022-02-14 10:35:40 -07:00
|
|
|
if (labels.includes('diff')) {
|
|
|
|
reviewers.add("lewis6991")
|
|
|
|
}
|
|
|
|
|
2022-02-13 15:15:20 -07:00
|
|
|
if (labels.includes('distribution')) {
|
|
|
|
reviewers.add("jamessan")
|
|
|
|
}
|
|
|
|
|
|
|
|
if (labels.includes('documentation')) {
|
|
|
|
reviewers.add("clason")
|
|
|
|
}
|
|
|
|
|
|
|
|
if (labels.includes('extmarks')) {
|
|
|
|
reviewers.add("bfredl")
|
|
|
|
}
|
|
|
|
|
|
|
|
if (labels.includes('filetype')) {
|
|
|
|
reviewers.add("clason")
|
|
|
|
reviewers.add("gpanders")
|
2022-10-18 02:13:58 -07:00
|
|
|
reviewers.add("smjonas")
|
2022-02-13 15:15:20 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
if (labels.includes('lsp')) {
|
2022-12-15 12:40:30 -07:00
|
|
|
team_reviewers.push('lsp');
|
2022-02-13 15:15:20 -07:00
|
|
|
}
|
|
|
|
|
2022-12-28 07:19:23 -07:00
|
|
|
if (labels.includes('platform:nix')) {
|
|
|
|
reviewers.add("teto")
|
|
|
|
}
|
|
|
|
|
2022-11-30 06:19:11 -07:00
|
|
|
if (labels.includes('project-management')) {
|
|
|
|
reviewers.add("bfredl")
|
|
|
|
reviewers.add("justinmk")
|
|
|
|
}
|
|
|
|
|
|
|
|
if (labels.includes('test')) {
|
|
|
|
reviewers.add("justinmk")
|
|
|
|
}
|
|
|
|
|
2022-02-13 15:15:20 -07:00
|
|
|
if (labels.includes('treesitter')) {
|
2022-12-15 12:40:30 -07:00
|
|
|
team_reviewers.push('treesitter');
|
2022-02-13 15:15:20 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
if (labels.includes('typo')) {
|
|
|
|
reviewers.add("dundargoc")
|
|
|
|
}
|
|
|
|
|
|
|
|
if (labels.includes('ui')) {
|
|
|
|
reviewers.add("bfredl")
|
|
|
|
}
|
|
|
|
|
|
|
|
if (labels.includes('vim-patch')) {
|
|
|
|
reviewers.add("seandewar")
|
|
|
|
reviewers.add("zeertzjq")
|
|
|
|
}
|
|
|
|
|
|
|
|
// Remove person that opened the PR since they can't review themselves
|
|
|
|
const pr_opener = pr_data.data.user.login
|
|
|
|
reviewers.delete(pr_opener)
|
|
|
|
|
|
|
|
github.rest.pulls.requestReviewers({
|
|
|
|
owner: context.repo.owner,
|
|
|
|
repo: context.repo.repo,
|
|
|
|
pull_number: context.issue.number,
|
2022-12-15 12:40:30 -07:00
|
|
|
reviewers: Array.from(reviewers),
|
|
|
|
team_reviewers: team_reviewers
|
2022-02-13 15:15:20 -07:00
|
|
|
});
|
|
|
|
}
|