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.