From bd7de0c4e44cd14a232cd1fa98f880cbbcf1b60d Mon Sep 17 00:00:00 2001 From: yp05327 <576951401@qq.com> Date: Fri, 8 Mar 2024 18:50:04 +0900 Subject: [PATCH] Add empty repo check in DetectAndHandleSchedules (#29606) (#29659) Backport #29606 --- services/actions/notifier_helper.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/services/actions/notifier_helper.go b/services/actions/notifier_helper.go index fe618d5d08..807494fb04 100644 --- a/services/actions/notifier_helper.go +++ b/services/actions/notifier_helper.go @@ -459,6 +459,10 @@ func handleSchedules( // DetectAndHandleSchedules detects the schedule workflows on the default branch and create schedule tasks func DetectAndHandleSchedules(ctx context.Context, repo *repo_model.Repository) error { + if repo.IsEmpty { + return nil + } + gitRepo, err := git.OpenRepository(context.Background(), repo.RepoPath()) if err != nil { return fmt.Errorf("git.OpenRepository: %w", err)