From da83a1845ffbd8c80b474932af6fc993ac6f8aa7 Mon Sep 17 00:00:00 2001 From: Josh Dales Date: Sun, 19 Feb 2023 18:10:19 -0500 Subject: [PATCH] Make sure that the changed files config values are an array --- dist/index.js | 10 ++++++++-- src/labeler.ts | 10 ++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/dist/index.js b/dist/index.js index c2c74d56..ef8dc9a1 100644 --- a/dist/index.js +++ b/dist/index.js @@ -273,8 +273,14 @@ function toChangedFilesMatchConfig(config) { else { // If it is not an array of strings then it should be array of further config options // so assign them to our `changedFilesMatchConfig` - changedFilesConfig.forEach(element => { - Object.assign(changedFilesMatchConfig.changedFiles, element); + changedFilesConfig.forEach(config => { + // Make sure that the values that we assign to our match config are an array + Object.entries(config).forEach(([key, value]) => { + const element = { + [key]: Array.isArray(value) ? value : [value] + }; + Object.assign(changedFilesMatchConfig.changedFiles, element); + }); }); } } diff --git a/src/labeler.ts b/src/labeler.ts index 1510d1cd..9d20e65d 100644 --- a/src/labeler.ts +++ b/src/labeler.ts @@ -173,8 +173,14 @@ function toChangedFilesMatchConfig(config: any): ChangedFilesMatchConfig { } else { // If it is not an array of strings then it should be array of further config options // so assign them to our `changedFilesMatchConfig` - changedFilesConfig.forEach(element => { - Object.assign(changedFilesMatchConfig.changedFiles, element); + changedFilesConfig.forEach(config => { + // Make sure that the values that we assign to our match config are an array + Object.entries(config).forEach(([key, value]) => { + const element = { + [key]: Array.isArray(value) ? value : [value] + }; + Object.assign(changedFilesMatchConfig.changedFiles, element); + }); }); } }