Skip to content

Commit

Permalink
Move the allowed Matchconfig keys into a constant
Browse files Browse the repository at this point in the history
  • Loading branch information
joshdales committed May 11, 2023
1 parent 51cc5e0 commit 09645fd
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/labeler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ export type MatchConfig = {

type ClientType = ReturnType<typeof github.getOctokit>;

const ALLOWED_CONFIG_KEYS = ['changed-files', 'head-branch', 'base-branch'];

export async function run() {
try {
const token = core.getInput('repo-token');
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 09645fd

Please sign in to comment.