Skip to content

Commit

Permalink
fix(webhook): we don't care about the default branch if it's missing
Browse files Browse the repository at this point in the history
  • Loading branch information
aymanbagabas committed Mar 8, 2024
1 parent 194455d commit abd5580
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 16 deletions.
5 changes: 1 addition & 4 deletions pkg/webhook/branch_tag.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,7 @@ func NewBranchTagEvent(ctx context.Context, user proto.User, repo proto.Reposito

payload.Repository.Owner.ID = owner.ID
payload.Repository.Owner.Username = owner.Username
payload.Repository.DefaultBranch, err = getDefaultBranch(repo)
if err != nil {
return BranchTagEvent{}, err
}
payload.Repository.DefaultBranch, _ = getDefaultBranch(repo)

return payload, nil
}
5 changes: 1 addition & 4 deletions pkg/webhook/collaborator.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,7 @@ func NewCollaboratorEvent(ctx context.Context, user proto.User, repo proto.Repos

payload.Repository.Owner.ID = owner.ID
payload.Repository.Owner.Username = owner.Username
payload.Repository.DefaultBranch, err = getDefaultBranch(repo)
if err != nil {
return CollaboratorEvent{}, err
}
payload.Repository.DefaultBranch, _ = getDefaultBranch(repo)

collab, err := datastore.GetCollabByUsernameAndRepo(ctx, dbx, collabUsername, repo.Name())
if err != nil {
Expand Down
5 changes: 1 addition & 4 deletions pkg/webhook/push.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,7 @@ func NewPushEvent(ctx context.Context, user proto.User, repo proto.Repository, r
return PushEvent{}, err
}

payload.Repository.DefaultBranch, err = getDefaultBranch(repo)
if err != nil {
return PushEvent{}, err
}
payload.Repository.DefaultBranch, _ = getDefaultBranch(repo)

rev := after
if !git.IsZeroHash(before) {
Expand Down
5 changes: 1 addition & 4 deletions pkg/webhook/repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,7 @@ func NewRepositoryEvent(ctx context.Context, user proto.User, repo proto.Reposit

payload.Repository.Owner.ID = owner.ID
payload.Repository.Owner.Username = owner.Username
payload.Repository.DefaultBranch, err = getDefaultBranch(repo)
if err != nil {
return RepositoryEvent{}, err
}
payload.Repository.DefaultBranch, _ = getDefaultBranch(repo)

return payload, nil
}

0 comments on commit abd5580

Please sign in to comment.