From c5b2e81172027400d87b2e2ad0c8704a09095351 Mon Sep 17 00:00:00 2001 From: Peter Nied Date: Wed, 6 Dec 2023 12:27:44 -0600 Subject: [PATCH] Handling for when no required approvers are included Signed-off-by: Peter Nied --- action.yml | 3 +++ dist/index.js | 2 +- index.js | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index 155eee3..446cc95 100644 --- a/action.yml +++ b/action.yml @@ -19,6 +19,9 @@ inputs: mock-approvers: description: 'Used only for testing' required: false + mock-pr-number: + description: 'Used only for testing' + required: false outputs: specific-approvals: diff --git a/dist/index.js b/dist/index.js index 205072f..d7f78e1 100644 --- a/dist/index.js +++ b/dist/index.js @@ -36751,7 +36751,7 @@ async function run() { const acceptedApprovers = []; pullRequestApprovers.forEach(approver => { - if (!requiredApprovers || requiredApprovers.filter(required => required === approver).length != 0) { + if (!requiredApprovers || !requiredApprovers.length || requiredApprovers.filter(required => required === approver).length != 0) { acceptedApprovers.push(approver); } }); diff --git a/index.js b/index.js index da1561e..d4deaaa 100644 --- a/index.js +++ b/index.js @@ -42,7 +42,7 @@ async function run() { const acceptedApprovers = []; pullRequestApprovers.forEach(approver => { - if (!requiredApprovers || requiredApprovers.filter(required => required === approver).length != 0) { + if (!requiredApprovers || !requiredApprovers.length || requiredApprovers.filter(required => required === approver).length != 0) { acceptedApprovers.push(approver); } });