mirror of
https://github.com/neovim/neovim.git
synced 2024-12-20 11:15:14 -07:00
ci: remove team reviewers
Team reviewers is a nice feature that comes with a severe drawback: it makes testing the workflows incredibly difficult as they won't work without a similar token by the tester.
This commit is contained in:
parent
515106ac08
commit
669030ec08
8
.github/scripts/remove-reviewers.js
vendored
8
.github/scripts/remove-reviewers.js
vendored
@ -2,17 +2,15 @@ module.exports = async ({github, context}) => {
|
|||||||
const requestedReviewers = await github.rest.pulls.listRequestedReviewers({
|
const requestedReviewers = await github.rest.pulls.listRequestedReviewers({
|
||||||
owner: context.repo.owner,
|
owner: context.repo.owner,
|
||||||
repo: context.repo.repo,
|
repo: context.repo.repo,
|
||||||
pull_number: context.issue.number
|
pull_number: context.issue.number,
|
||||||
});
|
});
|
||||||
|
|
||||||
const reviewers = requestedReviewers.data.users.map(e => e.login)
|
const reviewers = requestedReviewers.data.users.map((e) => e.login);
|
||||||
const team_reviewers = requestedReviewers.data.teams.map(e => e.name);
|
|
||||||
|
|
||||||
github.rest.pulls.removeRequestedReviewers({
|
github.rest.pulls.removeRequestedReviewers({
|
||||||
owner: context.repo.owner,
|
owner: context.repo.owner,
|
||||||
repo: context.repo.repo,
|
repo: context.repo.repo,
|
||||||
pull_number: context.issue.number,
|
pull_number: context.issue.number,
|
||||||
reviewers: reviewers,
|
reviewers: reviewers,
|
||||||
team_reviewers: team_reviewers
|
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
108
.github/scripts/reviews.js
vendored
108
.github/scripts/reviews.js
vendored
@ -2,101 +2,107 @@ module.exports = async ({github, context}) => {
|
|||||||
const pr_data = await github.rest.pulls.get({
|
const pr_data = await github.rest.pulls.get({
|
||||||
owner: context.repo.owner,
|
owner: context.repo.owner,
|
||||||
repo: context.repo.repo,
|
repo: context.repo.repo,
|
||||||
pull_number: context.issue.number
|
pull_number: context.issue.number,
|
||||||
})
|
});
|
||||||
const labels = pr_data.data.labels.map(e => e.name)
|
const labels = pr_data.data.labels.map((e) => e.name);
|
||||||
|
|
||||||
const reviewers = new Set()
|
const reviewers = new Set();
|
||||||
const team_reviewers = new Set()
|
if (labels.includes("api")) {
|
||||||
if (labels.includes('api')) {
|
reviewers.add("bfredl");
|
||||||
reviewers.add("bfredl")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (labels.includes('build')) {
|
if (labels.includes("build")) {
|
||||||
team_reviewers.add('ci');
|
reviewers.add("dundargoc");
|
||||||
|
reviewers.add("jamessan");
|
||||||
|
reviewers.add("justinmk");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (labels.includes('ci')) {
|
if (labels.includes("ci")) {
|
||||||
team_reviewers.add('ci');
|
reviewers.add("dundargoc");
|
||||||
|
reviewers.add("jamessan");
|
||||||
|
reviewers.add("justinmk");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (labels.includes('column')) {
|
if (labels.includes("column")) {
|
||||||
reviewers.add("lewis6991")
|
reviewers.add("lewis6991");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (labels.includes('dependencies')) {
|
if (labels.includes("dependencies")) {
|
||||||
reviewers.add("jamessan")
|
reviewers.add("jamessan");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (labels.includes('diagnostic')) {
|
if (labels.includes("diagnostic")) {
|
||||||
reviewers.add("gpanders")
|
reviewers.add("gpanders");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (labels.includes('diff')) {
|
if (labels.includes("diff")) {
|
||||||
reviewers.add("lewis6991")
|
reviewers.add("lewis6991");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (labels.includes('distribution')) {
|
if (labels.includes("distribution")) {
|
||||||
reviewers.add("jamessan")
|
reviewers.add("jamessan");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (labels.includes('documentation')) {
|
if (labels.includes("documentation")) {
|
||||||
reviewers.add("clason")
|
reviewers.add("clason");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (labels.includes('extmarks')) {
|
if (labels.includes("extmarks")) {
|
||||||
reviewers.add("bfredl")
|
reviewers.add("bfredl");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (labels.includes('filetype')) {
|
if (labels.includes("filetype")) {
|
||||||
reviewers.add("clason")
|
reviewers.add("clason");
|
||||||
reviewers.add("gpanders")
|
reviewers.add("gpanders");
|
||||||
reviewers.add("smjonas")
|
reviewers.add("smjonas");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (labels.includes('lsp')) {
|
if (labels.includes("lsp")) {
|
||||||
team_reviewers.add('lsp');
|
reviewers.add("folke");
|
||||||
|
reviewers.add("glepnir");
|
||||||
|
reviewers.add("mfussenegger");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (labels.includes('platform:nix')) {
|
if (labels.includes("platform:nix")) {
|
||||||
reviewers.add("teto")
|
reviewers.add("teto");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (labels.includes('project-management')) {
|
if (labels.includes("project-management")) {
|
||||||
reviewers.add("bfredl")
|
reviewers.add("bfredl");
|
||||||
reviewers.add("justinmk")
|
reviewers.add("justinmk");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (labels.includes('test')) {
|
if (labels.includes("test")) {
|
||||||
reviewers.add("justinmk")
|
reviewers.add("justinmk");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (labels.includes('treesitter')) {
|
if (labels.includes("treesitter")) {
|
||||||
team_reviewers.add('treesitter');
|
reviewers.add("bfredl");
|
||||||
|
reviewers.add("clason");
|
||||||
|
reviewers.add("lewis6991");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (labels.includes('typo')) {
|
if (labels.includes("typo")) {
|
||||||
reviewers.add("dundargoc")
|
reviewers.add("dundargoc");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (labels.includes('ui')) {
|
if (labels.includes("ui")) {
|
||||||
reviewers.add("bfredl")
|
reviewers.add("bfredl");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (labels.includes('vim-patch')) {
|
if (labels.includes("vim-patch")) {
|
||||||
reviewers.add("seandewar")
|
reviewers.add("seandewar");
|
||||||
reviewers.add("zeertzjq")
|
reviewers.add("zeertzjq");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove person that opened the PR since they can't review themselves
|
// Remove person that opened the PR since they can't review themselves
|
||||||
const pr_opener = pr_data.data.user.login
|
const pr_opener = pr_data.data.user.login;
|
||||||
reviewers.delete(pr_opener)
|
reviewers.delete(pr_opener);
|
||||||
|
|
||||||
github.rest.pulls.requestReviewers({
|
github.rest.pulls.requestReviewers({
|
||||||
owner: context.repo.owner,
|
owner: context.repo.owner,
|
||||||
repo: context.repo.repo,
|
repo: context.repo.repo,
|
||||||
pull_number: context.issue.number,
|
pull_number: context.issue.number,
|
||||||
reviewers: Array.from(reviewers),
|
reviewers: Array.from(reviewers),
|
||||||
team_reviewers: Array.from(team_reviewers)
|
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
1
.github/workflows/add-reviewers.yml
vendored
1
.github/workflows/add-reviewers.yml
vendored
@ -13,7 +13,6 @@ jobs:
|
|||||||
- name: 'Request reviewers'
|
- name: 'Request reviewers'
|
||||||
uses: actions/github-script@v6
|
uses: actions/github-script@v6
|
||||||
with:
|
with:
|
||||||
github-token: ${{ secrets.TEAM_REVIEW }}
|
|
||||||
script: |
|
script: |
|
||||||
const script = require('./.github/scripts/reviews.js')
|
const script = require('./.github/scripts/reviews.js')
|
||||||
await script({github, context})
|
await script({github, context})
|
||||||
|
1
.github/workflows/labeler.yml
vendored
1
.github/workflows/labeler.yml
vendored
@ -43,7 +43,6 @@ jobs:
|
|||||||
- name: 'Request reviewers'
|
- name: 'Request reviewers'
|
||||||
uses: actions/github-script@v6
|
uses: actions/github-script@v6
|
||||||
with:
|
with:
|
||||||
github-token: ${{ secrets.TEAM_REVIEW }}
|
|
||||||
script: |
|
script: |
|
||||||
const script = require('./.github/scripts/reviews.js')
|
const script = require('./.github/scripts/reviews.js')
|
||||||
await script({github, context})
|
await script({github, context})
|
||||||
|
1
.github/workflows/remove-reviewers.yml
vendored
1
.github/workflows/remove-reviewers.yml
vendored
@ -12,7 +12,6 @@ jobs:
|
|||||||
- name: 'Remove reviewers'
|
- name: 'Remove reviewers'
|
||||||
uses: actions/github-script@v6
|
uses: actions/github-script@v6
|
||||||
with:
|
with:
|
||||||
github-token: ${{ secrets.TEAM_REVIEW }}
|
|
||||||
script: |
|
script: |
|
||||||
const script = require('./.github/scripts/remove-reviewers.js')
|
const script = require('./.github/scripts/remove-reviewers.js')
|
||||||
await script({github, context})
|
await script({github, context})
|
||||||
|
Loading…
Reference in New Issue
Block a user