From 845d437256f84aec0dd1bb3647ec3786b88641fe Mon Sep 17 00:00:00 2001 From: glaszig Date: Fri, 11 Dec 2015 02:06:56 +0100 Subject: [PATCH] move build skipping regular expression variable into global scope --- controller/hook.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/controller/hook.go b/controller/hook.go index 569e29805..329fcac01 100644 --- a/controller/hook.go +++ b/controller/hook.go @@ -20,6 +20,8 @@ import ( "github.com/drone/drone/yaml/matrix" ) +var skipRe = regexp.MustCompile(`\[(?i:ci *skip|skip *ci)\]`) + func PostHook(c *gin.Context) { remote_ := remote.FromContext(c) @@ -41,7 +43,6 @@ func PostHook(c *gin.Context) { // skip the build if any case-insensitive combination of the words "skip" and "ci" // wrapped in square brackets appear in the commit message - skipRe := regexp.MustCompile(`\[(?i:ci *skip|skip *ci)\]`) skipMatches := skipRe.FindStringSubmatch(build.Message) if len(skipMatches) > 0 { log.Infof("ignoring hook. %s found in %s", skipMatches[0], build.Commit)