Create new interfaces for MatchConfig

This commit is contained in:
Josh Dales
2023-01-28 23:12:53 -05:00
parent 922ffdf5ad
commit 7a5c525049
2 changed files with 21 additions and 12 deletions

View File

@@ -3,15 +3,19 @@ import * as github from '@actions/github';
import * as yaml from 'js-yaml';
import {Minimatch} from 'minimatch';
import {checkBranch, toMatchConfigWithBranches} from './branch';
import {checkBranch, toBranchMatchConfig, BranchMatchConfig} from './branch';
interface MatchConfig {
interface FilesChangedMatchConfig {
all?: string[];
any?: string[];
headBranch?: string[];
baseBranch?: string[];
filesChanged?: {
all?: string[];
any?: string[];
};
}
type MatchConfig = FilesChangedMatchConfig & BranchMatchConfig;
type StringOrMatchConfig = string | MatchConfig;
type ClientType = ReturnType<typeof github.getOctokit>;
@@ -152,7 +156,12 @@ function toMatchConfig(config: StringOrMatchConfig): MatchConfig {
};
}
return toMatchConfigWithBranches(config);
const branchConfig = toBranchMatchConfig(config);
return {
...config,
...branchConfig
};
}
function printPattern(matcher: Minimatch): string {