Ignore gitlab push events without commits (#3339)

Example of the resulting buggy pipeline:


![image](https://github.com/woodpecker-ci/woodpecker/assets/32853499/1e4bedc6-465b-466e-8d89-a7348e374c7f)
This commit is contained in:
Lukas
2024-02-07 01:24:08 +01:00
committed by GitHub
parent db4a50951c
commit baf2e645bc
2 changed files with 6 additions and 2 deletions

View File

@@ -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)