0
0
mirror of https://github.com/renovatebot/renovate.git synced 2024-12-22 13:38:32 +00:00
renovatebot_renovate/lib/util/package-rules/base-branches.ts
Rhys Arkins 69dab293f5 feat(packageRules)!: support regex or glob matching for all (#28591)
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2024-07-25 15:28:16 +02:00

22 lines
584 B
TypeScript

import is from '@sindresorhus/is';
import type { PackageRule, PackageRuleInputConfig } from '../../config/types';
import { matchRegexOrGlobList } from '../string-match';
import { Matcher } from './base';
export class BaseBranchesMatcher extends Matcher {
override matches(
{ baseBranch }: PackageRuleInputConfig,
{ matchBaseBranches }: PackageRule,
): boolean | null {
if (is.undefined(matchBaseBranches)) {
return null;
}
if (is.undefined(baseBranch)) {
return false;
}
return matchRegexOrGlobList(baseBranch, matchBaseBranches);
}
}