From 14e329b33ceec145028237ef8bf2370d161b39b5 Mon Sep 17 00:00:00 2001 From: Earl Warren Date: Thu, 30 Oct 2025 15:44:30 +0100 Subject: [PATCH] chore(tests): allow actions.InsertRun to be used when no job exists It will never happen in production but is convenient when unit testing. --- models/actions/run.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/models/actions/run.go b/models/actions/run.go index 79a6683df9..d8a37d0b60 100644 --- a/models/actions/run.go +++ b/models/actions/run.go @@ -350,8 +350,10 @@ func InsertRun(ctx context.Context, run *ActionRun, jobs []*jobparser.SingleWork Status: status, }) } - if err := db.Insert(ctx, runJobs); err != nil { - return err + if len(runJobs) > 0 { + if err := db.Insert(ctx, runJobs); err != nil { + return err + } } // if there is a job in the waiting status, increase tasks version.