diff --git a/services/convert/convert.go b/services/convert/convert.go index 744153d8c3..259ce13dd9 100644 --- a/services/convert/convert.go +++ b/services/convert/convert.go @@ -596,6 +596,9 @@ func ListActionWorkflows(ctx context.Context, gitrepo *git.Repository, repo *rep } func GetActionWorkflow(ctx context.Context, gitrepo *git.Repository, repo *repo_model.Repository, workflowID string) (*api.ActionWorkflow, error) { + if repo.DefaultBranch == "" { + return nil, util.NewNotExistErrorf("workflow %q not found", workflowID) + } defaultBranchCommit, err := gitrepo.GetBranchCommit(repo.DefaultBranch) if err != nil { return nil, err