From 85288ae4aaaa30987fe3d960d973cdcd0d6798ed Mon Sep 17 00:00:00 2001 From: shiftinv Date: Sat, 3 Sep 2022 02:30:04 +0200 Subject: [PATCH] fix: use correct offsets for branch filter --- lib/filter.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/filter.ts b/lib/filter.ts index c5420c2..b10cf95 100644 --- a/lib/filter.ts +++ b/lib/filter.ts @@ -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"; } }