Skip to content

Commit

Permalink
chore: debug
Browse files Browse the repository at this point in the history
  • Loading branch information
devindford committed Aug 7, 2024
1 parent 8f64982 commit 14682f2
Showing 1 changed file with 24 additions and 26 deletions.
50 changes: 24 additions & 26 deletions .github/workflows/codeowner_review_status.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 14682f2

Please sign in to comment.