From 504fbfeb7e555b60413191b9ddb9f54e35d72518 Mon Sep 17 00:00:00 2001 From: 14Richa Date: Tue, 25 Jul 2023 13:45:07 +0530 Subject: [PATCH] minor fix --- .github/workflows/update-maintainers.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) 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`); }