fix: use correct offsets for branch filter

This commit is contained in:
shiftinv 2022-09-03 02:30:04 +02:00
parent e164172344
commit 85288ae4aa
1 changed files with 4 additions and 4 deletions

View File

@ -14,14 +14,14 @@ export default function filter(headers: Headers, json: any, config: UrlConfig):
if (event === "push" && refMatch) {
// check if branch is allowed
if (
refMatch[0] == "heads" && config.allowBranches !== undefined &&
!config.allowBranches.includes(refMatch[1])
refMatch[1] == "heads" && config.allowBranches !== undefined &&
!config.allowBranches.includes(refMatch[2])
) {
return `branch '${refMatch[1]}' not in ${JSON.stringify(config.allowBranches)}`;
return `branch '${refMatch[2]}' not in ${JSON.stringify(config.allowBranches)}`;
}
// check if it's a tag
if (refMatch[0] == "tags" && config.hideTags === true) {
if (refMatch[1] == "tags" && config.hideTags === true) {
return "tag";
}
}