Skip to content

Commit

Permalink
fix(approvals-satisfied): correctly handle list of users from codeowners
Browse files Browse the repository at this point in the history
  • Loading branch information
sjschmidt93 authored Jul 9, 2024
1 parent 32e0580 commit 32bf027
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/helpers/approvals-satisfied.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ export const approvalsSatisfied = async ({
);

const codeOwnersEntrySatisfiesApprovals = async (entry: Pick<CodeOwnersEntry, 'owners'>) => {
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());
Expand All @@ -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,
Expand Down

0 comments on commit 32bf027

Please sign in to comment.