diff --git a/.github/workflows/codeowner_review_status.yml b/.github/workflows/codeowner_review_status.yml index 3a4ebcab34b2e..b4df6d4318826 100644 --- a/.github/workflows/codeowner_review_status.yml +++ b/.github/workflows/codeowner_review_status.yml @@ -66,32 +66,6 @@ jobs: .map(review => review.user.login) ); - // Check if a user is a member of a team - async function checkTeamMembership(teamSlug) { - try { - const { data: teamMembers } = await github.rest.teams.listMembersInOrg({ - org: context.repo.owner, - team_slug: teamSlug, - }); - return teamMembers.map(teamMember => { - const user = teamMember.login; - if (approvals.has(user)) { - return teamSlug; - } - }); - } catch (error) { - console.error(`Error checking membership for team ${teamSlug}: ${error}`); - return false; - } - } - - let approvingTeams = [] - - for (const teamSlug of teamSlugs) { - const teamApprovalStatus = await checkTeamMembership(teamSlug); - approvingTeams.push(teamApprovalStatus) - } - console.log(approvingTeams) // Function to check if a file matches a pattern const matchesPattern = (file, pattern) => { // Handle directory patterns @@ -149,6 +123,30 @@ jobs: console.log('No relevant code owners found for the changed files. Skipping check.'); return; } + + // Check if a user is a member of a team + async function checkTeamMembership(teamSlug) { + try { + const { data: teamMembers } = await github.rest.teams.listMembersInOrg({ + org: context.repo.owner, + team_slug: teamSlug, + }); + return teamMembers.map(teamMember => { + const user = teamMember.login; + if (approvals.has(user)) { + return teamSlug; + } + }); + } catch (error) { + console.error(`Error checking membership for team ${teamSlug}: ${error}`); + return false; + } + } + + let approvingTeams = [] + + console.log(relevantOwners) + console.log(approvingTeams) const codeOwnerStatus = Array.from(relevantOwners).map(owner => ({ owner,