Skip to content

Commit

Permalink
Handling for when no required approvers are included
Browse files Browse the repository at this point in the history
Signed-off-by: Peter Nied <[email protected]>
  • Loading branch information
peternied committed Dec 6, 2023
1 parent 1ff344f commit c5b2e81
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
});
Expand Down
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
});
Expand Down

0 comments on commit c5b2e81

Please sign in to comment.