You've already forked woodpecker
mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-07-12 22:21:40 +02:00
Move "skip ci" logic into global pipeline conditions (#2216)
... and make custom errors follow std err conventions this fix a 500 response if the whole pipeline is filtered out
This commit is contained in:
@ -22,7 +22,6 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"regexp"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/rs/zerolog/log"
|
||||
@ -35,8 +34,6 @@ import (
|
||||
"github.com/woodpecker-ci/woodpecker/shared/token"
|
||||
)
|
||||
|
||||
var skipRe = regexp.MustCompile(`\[(?i:ci *skip|skip *ci)\]`)
|
||||
|
||||
// GetQueueInfo
|
||||
//
|
||||
// @Summary Get pipeline queue information
|
||||
@ -140,21 +137,6 @@ func PostHook(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
//
|
||||
// Skip if commit message contains skip-ci
|
||||
// TODO: move into global pipeline conditions logic
|
||||
//
|
||||
|
||||
// skip the tmpPipeline if any case-insensitive combination of the words "skip" and "ci"
|
||||
// wrapped in square brackets appear in the commit message
|
||||
skipMatch := skipRe.FindString(tmpPipeline.Message)
|
||||
if len(skipMatch) > 0 {
|
||||
msg := fmt.Sprintf("ignoring hook: %s found in %s", skipMatch, tmpPipeline.Commit)
|
||||
log.Debug().Msg(msg)
|
||||
c.String(http.StatusNoContent, msg)
|
||||
return
|
||||
}
|
||||
|
||||
//
|
||||
// 2. Get related repo from store and take repo renaming into account
|
||||
//
|
||||
|
Reference in New Issue
Block a user