Better check for empty configs in checkAll

This commit is contained in:
Josh Dales
2023-05-17 07:05:19 -04:00
parent a256a58edf
commit 57d34076e0
4 changed files with 29 additions and 13 deletions

View File

@@ -225,7 +225,10 @@ export function checkAny(
changedFiles: string[]
): boolean {
core.debug(` checking "any" patterns`);
if (!matchConfigs.length) {
if (
!matchConfigs.length ||
!matchConfigs.some(configOption => Object.keys(configOption).length)
) {
core.debug(` no "any" patterns to check`);
return false;
}
@@ -262,10 +265,7 @@ export function checkAll(
core.debug(` checking "all" patterns`);
if (
!matchConfigs.length ||
// Make sure that all the configs have keys that we can check for
!matchConfigs.some(configOption =>
ALLOWED_CONFIG_KEYS.includes(Object.keys(configOption)[0])
)
!matchConfigs.some(configOption => Object.keys(configOption).length)
) {
core.debug(` no "all" patterns to check`);
return false;