Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Zettat123 committed Jan 14, 2025
1 parent cca20fb commit 06b5215
Showing 1 changed file with 4 additions and 17 deletions.
21 changes: 4 additions & 17 deletions services/actions/concurrency.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
package actions

import (
"bytes"
"fmt"

actions_model "code.gitea.io/gitea/models/actions"
Expand All @@ -28,26 +27,14 @@ func evaluateJobConcurrency(run *actions_model.ActionRun, actionRunJob *actions_
return "", false, fmt.Errorf("not single workflow")
}

// FIXME: cannot get job needs
singleWorkflow := singleWorkflows[0]
singleWorkflow.Job()
actJobMap := map[string]*act_model.Job{}
if err := singleWorkflow.RawJobs.Decode(&actJobMap); err != nil {
return "", false, fmt.Errorf("decode act job: %w", err)
}

actWorkflow, err := act_model.ReadWorkflow(bytes.NewReader(actionRunJob.WorkflowPayload))
if err != nil {
return "", false, fmt.Errorf("read workflow: %w", err)
}
actJob := actWorkflow.GetJob(actionRunJob.JobID)

if jobResults == nil {
jobResults = map[string]*jobparser.JobResult{}
}
jobResults[actionRunJob.JobID] = &jobparser.JobResult{}
jobResults[actionRunJob.JobID] = &jobparser.JobResult{
Needs: actionRunJob.Needs,
}

concurrencyGroup, concurrencyCancel := jobparser.EvaluateJobConcurrency(rawConcurrency, actionRunJob.JobID, actJob, gitCtx, vars, jobResults)
concurrencyGroup, concurrencyCancel := jobparser.EvaluateJobConcurrency(rawConcurrency, actionRunJob.JobID, gitCtx, vars, jobResults)

return concurrencyGroup, concurrencyCancel, nil
}

0 comments on commit 06b5215

Please sign in to comment.