From 09645fd40dff045e628c96d5717a109aaf8131d5 Mon Sep 17 00:00:00 2001 From: Josh Dales Date: Thu, 11 May 2023 16:37:58 -0400 Subject: [PATCH] Move the allowed Matchconfig keys into a constant --- src/labeler.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/labeler.ts b/src/labeler.ts index 2ba31c75..6b056543 100644 --- a/src/labeler.ts +++ b/src/labeler.ts @@ -25,6 +25,8 @@ export type MatchConfig = { type ClientType = ReturnType; +const ALLOWED_CONFIG_KEYS = ['changed-files', 'head-branch', 'base-branch']; + export async function run() { try { const token = core.getInput('repo-token'); @@ -143,10 +145,7 @@ export function getLabelConfigMapFromObject( const newConfigs = value.map(toMatchConfig); updatedConfig.push({[key]: newConfigs}); } - } else if ( - // These are the keys that we accept and know how to process - ['changed-files', 'head-branch', 'base-branch'].includes(key) - ) { + } else if (ALLOWED_CONFIG_KEYS.includes(key)) { const newMatchConfig = toMatchConfig({[key]: value}); // Find or set the `any` key so that we can add these properties to that rule, // Or create a new `any` key and add that to our array of configs.