Skip to content

Commit 52dacf0

Browse files
authored
Update services/actions/notifier_helper.go
1 parent 98a539b commit 52dacf0

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

services/actions/notifier_helper.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,12 @@ func notify(ctx context.Context, input *notifyInput) error {
127127
defer gitRepo.Close()
128128

129129
ref := input.Ref
130-
if ref == "" || input.Event == webhook_module.HookEventDelete {
130+
if input.Event == webhook_module.HookEventDelete {
131+
// The event is deleting a reference, so it will fail to get the commit for a deleted reference.
132+
// Set ref to empty string to fall back to the default branch.
133+
ref = ""
134+
}
135+
if ref == "" {
131136
ref = input.Repo.DefaultBranch
132137
}
133138

0 commit comments

Comments
 (0)