mirror of
https://github.com/actions/labeler.git
synced 2025-12-14 13:47:02 +00:00
Add options for getting the head or base branch
This commit is contained in:
@@ -9,6 +9,8 @@ interface MatchConfig {
|
||||
all?: string[];
|
||||
any?: string[];
|
||||
branch?: string[];
|
||||
headBranch?: string[];
|
||||
baseBranch?: string[];
|
||||
}
|
||||
|
||||
type StringOrMatchConfig = string | MatchConfig;
|
||||
@@ -240,6 +242,18 @@ function checkMatch(changedFiles: string[], matchConfig: MatchConfig): boolean {
|
||||
}
|
||||
}
|
||||
|
||||
if (matchConfig.headBranch !== undefined) {
|
||||
if (!checkBranch(matchConfig.headBranch, 'head')) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (matchConfig.baseBranch !== undefined) {
|
||||
if (!checkBranch(matchConfig.baseBranch, 'base')) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user