From 869286595fe6b99ce882ece80e0795ab1f8b3a8d Mon Sep 17 00:00:00 2001 From: yp05327 <576951401@qq.com> Date: Tue, 5 Mar 2024 23:47:07 +0900 Subject: [PATCH] Add empty repo check in `DetectAndHandleSchedules` (#29606) ![image](https://github.com/go-gitea/gitea/assets/18380374/e6081301-bd3e-4cf6-ba4e-e574348dffb4) (cherry picked from commit 3f3335ae51d89520acce6573e870590423248c5c) --- 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 cc21d54f8a..ff33c5a94d 100644 --- a/services/actions/notifier_helper.go +++ b/services/actions/notifier_helper.go @@ -536,6 +536,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 := gitrepo.OpenRepository(context.Background(), repo) if err != nil { return fmt.Errorf("git.OpenRepository: %w", err)