Add check for empty objects in checkAll

This commit is contained in:
Josh Dales
2023-05-15 10:45:56 -04:00
parent a5bed11d4d
commit a256a58edf
3 changed files with 12 additions and 3 deletions
+2 -1
View File
@@ -1,2 +1,3 @@
label:
- unknown: 'this-is-not-supported'
- all:
- unknown: 'this-is-not-supported'
+3 -1
View File
@@ -467,7 +467,9 @@ exports.checkAny = checkAny;
// equivalent to "Array.every()" but expanded for debugging and clarity
function checkAll(matchConfigs, changedFiles) {
core.debug(` checking "all" patterns`);
if (!matchConfigs.length) {
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]))) {
core.debug(` no "all" patterns to check`);
return false;
}
+7 -1
View File
@@ -260,7 +260,13 @@ export function checkAll(
changedFiles: string[]
): boolean {
core.debug(` checking "all" patterns`);
if (!matchConfigs.length) {
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])
)
) {
core.debug(` no "all" patterns to check`);
return false;
}