chore(tests): allow actions.InsertRun to be used when no job exists

It will never happen in production but is convenient when unit testing.
This commit is contained in:
Earl Warren 2025-10-30 15:44:30 +01:00
parent bf7c63a2ae
commit 14e329b33c
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00

View file

@ -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.