diff --git a/.github/workflows/update-maintainers.yml b/.github/workflows/update-maintainers.yml index dfc03689..44528016 100644 --- a/.github/workflows/update-maintainers.yml +++ b/.github/workflows/update-maintainers.yml @@ -118,16 +118,15 @@ jobs: // Update for removed usernames for (const username of removedUsernames) { - const maintainer = maintainers.find(maintainer => maintainer.github === username); - if (maintainer) { - const repoIndex = maintainer.repos.indexOf(repoName); + const index = maintainers.findIndex(maintainer => maintainer.github === username); + if (index !== -1) { + const maintainer = maintainers[index]; + const repoIndex = maintainer.repos.findIndex(repo => repo === repoName); if (repoIndex !== -1) { maintainer.repos.splice(repoIndex, 1); console.log(`Removed repository ${repoName} from maintainer ${username}`); - if (maintainer.repos.length === 0) { - const index = maintainers.indexOf(maintainer); maintainers.splice(index, 1); console.log(`Removed maintainer ${username} as they have no other repositories`); }