From 32bf027a2ad36e0f528a93f91f8aa30dbda53127 Mon Sep 17 00:00:00 2001 From: Steven Schmidt Date: Tue, 9 Jul 2024 09:18:20 -0500 Subject: [PATCH] fix(approvals-satisfied): correctly handle list of users from codeowners --- src/helpers/approvals-satisfied.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/helpers/approvals-satisfied.ts b/src/helpers/approvals-satisfied.ts index 65215522..4ef44700 100644 --- a/src/helpers/approvals-satisfied.ts +++ b/src/helpers/approvals-satisfied.ts @@ -67,11 +67,11 @@ export const approvalsSatisfied = async ({ ); const codeOwnersEntrySatisfiesApprovals = async (entry: Pick) => { - const loginsLists = await map(entry.owners, async teamOrUser => { - if (isTeam(teamOrUser)) { + const loginsLists = await map(entry.owners, async teamOrUsers => { + if (isTeam(teamOrUsers)) { return await fetchTeamLogins(teamOrUser); } else { - return [teamOrUser]; + return teamOrUsers.split(','); } }); const codeOwnerLogins = uniq(loginsLists.flat()); @@ -94,7 +94,7 @@ export const approvalsSatisfied = async ({ const createArtificialCodeOwnersEntry = ({ teams = [], users = [] }: { teams?: string[]; users?: string[] }) => [ { owners: teams.concat(users) } ]; -const isTeam = (teamOrUser: string) => teamOrUser.includes('/'); +const isTeam = (teamOrUsers: string) => teamOrUsers.includes('/'); const fetchTeamLogins = async (team: string) => { const { data } = await octokit.teams.listMembersInOrg({ org: context.repo.owner,