mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-11-24 02:41:01 +00:00
move build skipping regular expression variable into global scope
This commit is contained in:
parent
77b5c6246d
commit
845d437256
1 changed files with 2 additions and 1 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue