Skip to content

Commit

Permalink
v4.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
skymoore committed Feb 10, 2024
1 parent b86ba4b commit 941b749
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8926,7 +8926,7 @@ async function main() {
const [owner, repoName] = ghRepo.split("/");
const repo = await octokit.repos.get({ owner, repo: repoName });

const orgTeams = await readOrgOctokit.paginate(
const allOrgTeams = await readOrgOctokit.paginate(
readOrgOctokit.teams.list,
{ org: orgName },
(response) => response.data
Expand Down Expand Up @@ -8963,6 +8963,26 @@ async function main() {
const requiredCodeownerEntities = await getRequiredCodeowners(changedFiles, repo.data, pr, octokit);
console.info(`Required codeowners: ${JSON.stringify(requiredCodeownerEntities)}`);

const orgTeams = [];

if (process.env["INPUT_LIMIT_ORG_TEAMS_TO_CODEOWNERS_FILE"] === "true") {
const requiredCodeownerEntitySlugs = new Set(Object.keys(requiredCodeownerEntities));
const filteredTeams = allOrgTeams.filter((team) => {
return requiredCodeownerEntitySlugs.has(team.slug);
});

if (filteredTeams.length !== requiredCodeownerEntitySlugs.size) {
for (const slug of requiredCodeownerEntitySlugs) {
if (!filteredTeams.some((team) => team.slug === slug)) {
console.warn(` Team: ${slug} not found in Org: ${orgName}`);
}
}
}
orgTeams.push(...filteredTeams);
} else {
orgTeams = allOrgTeams;
}

const approvedCodeowners = [];

for (const review of reviews) {
Expand Down Expand Up @@ -9040,7 +9060,6 @@ async function main() {

main();


})();

module.exports = __webpack_exports__;
Expand Down

0 comments on commit 941b749

Please sign in to comment.