1
0
mirror of https://github.com/woodpecker-ci/woodpecker.git synced 2024-12-24 10:07:21 +02:00

gitea: add check if pull_request webhook is missing pull info (#4305)

This commit is contained in:
6543 2024-11-05 14:51:12 +01:00 committed by GitHub
parent 08cdfbde94
commit 4270eca597
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -16,6 +16,7 @@
package gitea
import (
"fmt"
"io"
"net/http"
"strings"
@ -111,6 +112,11 @@ func parsePullRequestHook(payload io.Reader) (*model.Repo, *model.Pipeline, erro
return nil, nil, err
}
if pr.PullRequest == nil {
// this should never have happened but it did - so we check
return nil, nil, fmt.Errorf("parsed pull_request webhook does not contain pull_request info")
}
// Don't trigger pipelines for non-code changes ...
if pr.Action != actionOpen && pr.Action != actionSync && pr.Action != actionClose {
log.Debug().Msgf("pull_request action is '%s' and no open or sync", pr.Action)