@@ -70,7 +70,7 @@ func PrepareConcurrencyForRunAndJobs(ctx context.Context, wfContent []byte, run
7070 // because it will be checked by job emitter
7171 if runJob .Status != actions_model .StatusBlocked && len (needs ) == 0 {
7272 var err error
73- runJob .ConcurrencyGroup , runJob .ConcurrencyCancel , err = evaluateJobConcurrency (ctx , runJob , vars , map [string ]* jobparser.JobResult {})
73+ runJob .ConcurrencyGroup , runJob .ConcurrencyCancel , err = evaluateJobConcurrency (run , runJob , vars , map [string ]* jobparser.JobResult {})
7474 if err != nil {
7575 return nil , fmt .Errorf ("evaluate job concurrency: %w" , err )
7676 }
@@ -83,12 +83,7 @@ func PrepareConcurrencyForRunAndJobs(ctx context.Context, wfContent []byte, run
8383 return runJobs , nil
8484}
8585
86- func evaluateJobConcurrency (ctx context.Context , actionRunJob * actions_model.ActionRunJob , vars map [string ]string , jobResults map [string ]* jobparser.JobResult ) (string , bool , error ) {
87- if err := actionRunJob .LoadRun (ctx ); err != nil {
88- return "" , false , err
89- }
90- run := actionRunJob .Run
91-
86+ func evaluateJobConcurrency (run * actions_model.ActionRun , actionRunJob * actions_model.ActionRunJob , vars map [string ]string , jobResults map [string ]* jobparser.JobResult ) (string , bool , error ) {
9287 rawConcurrency := & act_model.RawConcurrency {
9388 Group : actionRunJob .RawConcurrencyGroup ,
9489 CancelInProgress : actionRunJob .RawConcurrencyCancel ,
@@ -102,7 +97,11 @@ func evaluateJobConcurrency(ctx context.Context, actionRunJob *actions_model.Act
10297 }
10398 actJob := actWorkflow .GetJob (actionRunJob .JobID )
10499
105- concurrencyGroup , concurrencyCancel := jobparser .EvaluateJobConcurrency (rawConcurrency , actJob , gitCtx , vars , jobResults )
100+ if len (jobResults ) == 0 {
101+ jobResults = map [string ]* jobparser.JobResult {actionRunJob .JobID : {}}
102+ }
103+
104+ concurrencyGroup , concurrencyCancel := jobparser .EvaluateJobConcurrency (rawConcurrency , actionRunJob .JobID , actJob , gitCtx , vars , jobResults )
106105
107106 return concurrencyGroup , concurrencyCancel , nil
108107}
0 commit comments