update InsertRun

This commit is contained in:
Zettat123 2025-07-22 14:50:50 -06:00
parent ea2bc926f5
commit a4b76b6544

View File

@ -18,12 +18,7 @@ import (
// InsertRun inserts a run
// The title will be cut off at 255 characters if it's longer than 255 characters.
func InsertRun(ctx context.Context, run *actions_model.ActionRun, jobs []*jobparser.SingleWorkflow) error {
ctx, committer, err := db.TxContext(ctx)
if err != nil {
return err
}
defer committer.Close()
return db.WithTx(ctx, func(ctx context.Context) error {
index, err := db.GetNextResourceIndex(ctx, "action_run_index", run.RepoID)
if err != nil {
return err
@ -94,7 +89,6 @@ func InsertRun(ctx context.Context, run *actions_model.ActionRun, jobs []*jobpar
RunsOn: job.RunsOn(),
Status: status,
}
// check job concurrency
if job.RawConcurrency != nil && job.RawConcurrency.Group != "" {
runJob.RawConcurrencyGroup = job.RawConcurrency.Group
@ -143,5 +137,6 @@ func InsertRun(ctx context.Context, run *actions_model.ActionRun, jobs []*jobpar
}
}
return committer.Commit()
return nil
})
}