2023-04-22 04:50:27 -07:00
|
|
|
module.exports = async ({ github, context }) => {
|
2022-02-13 15:15:20 -07:00
|
|
|
const pr_data = await github.rest.pulls.get({
|
|
|
|
owner: context.repo.owner,
|
|
|
|
repo: context.repo.repo,
|
2023-04-22 04:50:27 -07:00
|
|
|
pull_number: context.issue.number,
|
|
|
|
});
|
|
|
|
const labels = pr_data.data.labels.map((e) => e.name);
|
|
|
|
const reviewers = new Set();
|
2023-04-26 09:25:27 -07:00
|
|
|
|
2023-04-22 04:50:27 -07:00
|
|
|
if (labels.includes("build")) {
|
|
|
|
reviewers.add("dundargoc");
|
|
|
|
reviewers.add("jamessan");
|
|
|
|
reviewers.add("justinmk");
|
2022-03-04 03:28:32 -07:00
|
|
|
}
|
|
|
|
|
2023-04-22 04:50:27 -07:00
|
|
|
if (labels.includes("ci")) {
|
|
|
|
reviewers.add("dundargoc");
|
|
|
|
reviewers.add("jamessan");
|
|
|
|
reviewers.add("justinmk");
|
2022-02-13 15:15:20 -07:00
|
|
|
}
|
|
|
|
|
2023-04-22 04:50:27 -07:00
|
|
|
if (labels.includes("column")) {
|
|
|
|
reviewers.add("lewis6991");
|
2022-02-14 10:35:40 -07:00
|
|
|
}
|
|
|
|
|
2024-05-29 06:59:43 -07:00
|
|
|
if (labels.includes("comment")) {
|
|
|
|
reviewers.add("echasnovski");
|
|
|
|
}
|
|
|
|
|
2023-12-13 19:06:59 -07:00
|
|
|
if (labels.includes("defaults")) {
|
|
|
|
reviewers.add("gpanders");
|
|
|
|
}
|
|
|
|
|
2023-04-22 04:50:27 -07:00
|
|
|
if (labels.includes("diagnostic")) {
|
|
|
|
reviewers.add("gpanders");
|
2022-02-13 15:15:20 -07:00
|
|
|
}
|
|
|
|
|
2023-04-22 04:50:27 -07:00
|
|
|
if (labels.includes("diff")) {
|
|
|
|
reviewers.add("lewis6991");
|
2022-02-14 10:35:40 -07:00
|
|
|
}
|
|
|
|
|
2023-04-22 04:50:27 -07:00
|
|
|
if (labels.includes("documentation")) {
|
|
|
|
reviewers.add("clason");
|
2022-02-13 15:15:20 -07:00
|
|
|
}
|
|
|
|
|
2024-05-13 11:11:15 -07:00
|
|
|
if (labels.includes("editorconfig")) {
|
|
|
|
reviewers.add("gpanders");
|
|
|
|
}
|
|
|
|
|
2024-05-29 06:59:43 -07:00
|
|
|
if (labels.includes("marks")) {
|
2023-04-22 04:50:27 -07:00
|
|
|
reviewers.add("bfredl");
|
2022-02-13 15:15:20 -07:00
|
|
|
}
|
|
|
|
|
2023-04-22 04:50:27 -07:00
|
|
|
if (labels.includes("filetype")) {
|
|
|
|
reviewers.add("clason");
|
|
|
|
reviewers.add("gpanders");
|
2022-02-13 15:15:20 -07:00
|
|
|
}
|
|
|
|
|
2024-05-29 06:59:43 -07:00
|
|
|
if (labels.includes("inccommand")) {
|
|
|
|
reviewers.add("famiu");
|
|
|
|
}
|
|
|
|
|
2023-04-22 04:50:27 -07:00
|
|
|
if (labels.includes("lsp")) {
|
2023-10-22 04:30:32 -07:00
|
|
|
reviewers.add("MariaSolOs");
|
2023-04-22 04:50:27 -07:00
|
|
|
reviewers.add("mfussenegger");
|
2022-02-13 15:15:20 -07:00
|
|
|
}
|
|
|
|
|
2024-05-29 06:59:43 -07:00
|
|
|
if (labels.includes("netrw")) {
|
|
|
|
reviewers.add("justinmk");
|
|
|
|
}
|
|
|
|
|
2023-09-27 08:53:06 -07:00
|
|
|
if (labels.includes("options")) {
|
|
|
|
reviewers.add("famiu");
|
|
|
|
}
|
|
|
|
|
2023-04-22 04:50:27 -07:00
|
|
|
if (labels.includes("platform:nix")) {
|
|
|
|
reviewers.add("teto");
|
2022-12-28 07:19:23 -07:00
|
|
|
}
|
|
|
|
|
2023-04-22 04:50:27 -07:00
|
|
|
if (labels.includes("project-management")) {
|
|
|
|
reviewers.add("bfredl");
|
|
|
|
reviewers.add("justinmk");
|
2022-11-30 06:19:11 -07:00
|
|
|
}
|
|
|
|
|
2024-05-13 11:11:15 -07:00
|
|
|
if (labels.includes("snippet")) {
|
|
|
|
reviewers.add("MariaSolOs");
|
|
|
|
}
|
|
|
|
|
2023-04-26 09:25:27 -07:00
|
|
|
if (labels.includes("statusline")) {
|
|
|
|
reviewers.add("famiu");
|
|
|
|
}
|
|
|
|
|
2023-04-22 04:50:27 -07:00
|
|
|
if (labels.includes("test")) {
|
|
|
|
reviewers.add("justinmk");
|
2022-11-30 06:19:11 -07:00
|
|
|
}
|
|
|
|
|
2023-04-22 04:50:27 -07:00
|
|
|
if (labels.includes("treesitter")) {
|
|
|
|
reviewers.add("bfredl");
|
|
|
|
reviewers.add("clason");
|
|
|
|
reviewers.add("lewis6991");
|
2024-05-13 11:11:15 -07:00
|
|
|
reviewers.add("wookayin");
|
2022-02-13 15:15:20 -07:00
|
|
|
}
|
|
|
|
|
2023-12-13 19:06:59 -07:00
|
|
|
if (labels.includes("tui")) {
|
|
|
|
reviewers.add("gpanders");
|
|
|
|
}
|
|
|
|
|
2023-04-22 04:50:27 -07:00
|
|
|
if (labels.includes("typo")) {
|
|
|
|
reviewers.add("dundargoc");
|
2022-02-13 15:15:20 -07:00
|
|
|
}
|
|
|
|
|
2023-04-22 04:50:27 -07:00
|
|
|
if (labels.includes("vim-patch")) {
|
|
|
|
reviewers.add("seandewar");
|
|
|
|
reviewers.add("zeertzjq");
|
2022-02-13 15:15:20 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
// Remove person that opened the PR since they can't review themselves
|
2023-04-22 04:50:27 -07:00
|
|
|
const pr_opener = pr_data.data.user.login;
|
|
|
|
reviewers.delete(pr_opener);
|
2022-02-13 15:15:20 -07:00
|
|
|
|
|
|
|
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),
|
2022-02-13 15:15:20 -07:00
|
|
|
});
|
2023-04-22 04:50:27 -07:00
|
|
|
};
|