mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-02-22 14:16:18 +00:00
Ignore gitlab push events without commits (#3339)
Example of the resulting buggy pipeline: 
This commit is contained in:
parent
db4a50951c
commit
baf2e645bc
2 changed files with 6 additions and 2 deletions
|
@ -655,6 +655,9 @@ func (g *GitLab) Hook(ctx context.Context, req *http.Request) (*model.Repo, *mod
|
|||
|
||||
return repo, pipeline, nil
|
||||
case *gitlab.PushEvent:
|
||||
if event.TotalCommitsCount == 0 {
|
||||
return nil, nil, &forge_types.ErrIgnoreEvent{Event: string(eventType), Reason: "no commits"}
|
||||
}
|
||||
return convertPushHook(event)
|
||||
case *gitlab.TagEvent:
|
||||
return convertTagHook(event)
|
||||
|
|
|
@ -46,11 +46,12 @@ var _ error = new(AuthError)
|
|||
var ErrNotImplemented = errors.New("not implemented")
|
||||
|
||||
type ErrIgnoreEvent struct {
|
||||
Event string
|
||||
Event string
|
||||
Reason string
|
||||
}
|
||||
|
||||
func (err *ErrIgnoreEvent) Error() string {
|
||||
return fmt.Sprintf("explicit ignored event '%s'", err.Event)
|
||||
return fmt.Sprintf("explicit ignored event '%s', reason: %s", err.Event, err.Reason)
|
||||
}
|
||||
|
||||
func (*ErrIgnoreEvent) Is(target error) bool {
|
||||
|
|
Loading…
Reference in a new issue