Skip to content

Commit

Permalink
imeplemented array concatenation method
Browse files Browse the repository at this point in the history
  • Loading branch information
Bullrich authored Jul 26, 2023
1 parent c01c880 commit 38cbfd6
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,17 +113,12 @@ export class ActionRunner {
this.logger.debug(JSON.stringify(rule));

// This is a list of all the users that need to approve a PR
const requiredUsers: string[] = [];
let requiredUsers: string[] = [];
// If team is set, we fetch the members of such team
if (rule.teams) {
for (const team of rule.teams) {
const members = await this.teamApi.getTeamMembers(team);
for (const member of members) {
// simple check to stop us from having duplicates
if (requiredUsers.indexOf(member) < 0) {
requiredUsers.push(member);
}
}
requiredUsers = concatArraysUniquely(requiredUsers, members);
}
// If, instead, users are set, we simply push them to the array as we don't need to scan a team
} else if (rule.users) {
Expand Down

0 comments on commit 38cbfd6

Please sign in to comment.