Skip to content

Commit

Permalink
Ignore push event if no head commit ID
Browse files Browse the repository at this point in the history
  • Loading branch information
m-mizutani committed Jun 10, 2024
1 parent f1410dc commit 65d12b6
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/controller/server/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ func refToBranch(v string) string {
func githubEventToScanInput(event interface{}) *model.ScanGitHubRepoInput {
switch ev := event.(type) {
case *github.PushEvent:
if ev.HeadCommit == nil || ev.HeadCommit.ID == nil {
utils.Logger().Warn("ignore push event without head commit", slog.Any("event", ev))
return nil
}

return &model.ScanGitHubRepoInput{
GitHubMetadata: model.GitHubMetadata{
GitHubCommit: model.GitHubCommit{
Expand Down

0 comments on commit 65d12b6

Please sign in to comment.