[Backport release-0.9] ci: use a set instead of array for team reviewers (#23835)

ci: use a set instead of array for team reviewers

Adding the same team multiple times will fails the review job.

(cherry picked from commit 4cb2b747c0)

Co-authored-by: dundargoc <gocdundar@gmail.com>
This commit is contained in:
github-actions[bot] 2023-05-30 20:29:26 +02:00 committed by GitHub
parent 09f97ff9a8
commit 2833230791
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -7,17 +7,17 @@ module.exports = async ({github, context}) => {
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 Array() 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.push('ci'); team_reviewers.add('ci');
} }
if (labels.includes('ci')) { if (labels.includes('ci')) {
team_reviewers.push('ci'); team_reviewers.add('ci');
} }
if (labels.includes('column')) { if (labels.includes('column')) {
@ -55,7 +55,7 @@ module.exports = async ({github, context}) => {
} }
if (labels.includes('lsp')) { if (labels.includes('lsp')) {
team_reviewers.push('lsp'); team_reviewers.add('lsp');
} }
if (labels.includes('platform:nix')) { if (labels.includes('platform:nix')) {
@ -72,7 +72,7 @@ module.exports = async ({github, context}) => {
} }
if (labels.includes('treesitter')) { if (labels.includes('treesitter')) {
team_reviewers.push('treesitter'); team_reviewers.add('treesitter');
} }
if (labels.includes('typo')) { if (labels.includes('typo')) {
@ -97,6 +97,6 @@ module.exports = async ({github, context}) => {
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: team_reviewers team_reviewers: Array.from(team_reviewers)
}); });
} }