diff --git a/dist/index.js b/dist/index.js index ccdf313..d4a29b2 100644 --- a/dist/index.js +++ b/dist/index.js @@ -33210,13 +33210,16 @@ async function run() { // Display all code owners info(`Owners With Modified Files: ${ownersWithModifiedFiles.join(' ')}`); //# Part 2: Requesting reviews based on owners listed above - //Remove the @ symbol at the start of every owner name const trimmed_owners = []; + //Remove the @ symbol at the start of every owner name for (const owner of ownersWithModifiedFiles) { trimmed_owners.push(owner.replace('@', '')); } //Remove PR author from the user list - trimmed_owners.splice(trimmed_owners.indexOf(response.data.user.login), 1); + const index = trimmed_owners.indexOf(response.data.user.login); + if (index >= 0) { + trimmed_owners.splice(index, 1); + } //No reviewers so stop here if (!trimmed_owners.length) { info('No reviewers to call'); diff --git a/src/index.ts b/src/index.ts index e933502..f2401f0 100644 --- a/src/index.ts +++ b/src/index.ts @@ -148,18 +148,18 @@ async function run(): Promise { info(`Owners With Modified Files: ${ownersWithModifiedFiles.join(' ')}`) //# Part 2: Requesting reviews based on owners listed above + const trimmed_owners: string[] = [] //Remove the @ symbol at the start of every owner name - const trimmed_owners: string[] = [] for (const owner of ownersWithModifiedFiles) { trimmed_owners.push(owner.replace('@', '')) } //Remove PR author from the user list - trimmed_owners.splice( - trimmed_owners.indexOf(response.data.user.login), - 1 - ) + const index = trimmed_owners.indexOf(response.data.user.login) + if (index >= 0) { + trimmed_owners.splice(index, 1) + } //No reviewers so stop here if (!trimmed_owners.length) {