MCPcopy
hub / github.com/nektos/act / runStepExecutor

Function runStepExecutor

pkg/runner/step.go:94–215  ·  view source on GitHub ↗
(step step, stage stepStage, executor common.Executor)

Source from the content-addressed store, hash-verified

92}
93
94func runStepExecutor(step step, stage stepStage, executor common.Executor) common.Executor {
95 return func(ctx context.Context) error {
96 logger := common.Logger(ctx)
97 rc := step.getRunContext()
98 stepModel := step.getStepModel()
99
100 ifExpression := step.getIfExpression(ctx, stage)
101 rc.CurrentStep = stepModel.ID
102
103 stepResult := &model.StepResult{
104 Outcome: model.StepStatusSuccess,
105 Conclusion: model.StepStatusSuccess,
106 Outputs: make(map[string]string),
107 }
108 if stage == stepStageMain {
109 rc.StepResults[rc.CurrentStep] = stepResult
110 }
111
112 err := setupEnv(ctx, step)
113 if err != nil {
114 return err
115 }
116
117 cctx := common.JobCancelContext(ctx)
118 rc.Cancelled = cctx != nil && cctx.Err() != nil
119
120 runStep, err := isStepEnabled(ctx, ifExpression, step, stage)
121 if err != nil {
122 stepResult.Conclusion = model.StepStatusFailure
123 stepResult.Outcome = model.StepStatusFailure
124 return err
125 }
126
127 if !runStep {
128 stepResult.Conclusion = model.StepStatusSkipped
129 stepResult.Outcome = model.StepStatusSkipped
130 logger.WithField("stepResult", stepResult.Outcome).Debugf("Skipping step '%s' due to '%s'", stepModel, ifExpression)
131 return nil
132 }
133
134 stepString := rc.ExprEval.Interpolate(ctx, stepModel.String())
135 if strings.Contains(stepString, "::add-mask::") {
136 stepString = "add-mask command"
137 }
138 logger.Infof("\u2B50 Run %s %s", stage, stepString)
139
140 // Prepare and clean Runner File Commands
141 actPath := rc.JobContainer.GetActPath()
142
143 outputFileCommand := path.Join("workflow", "outputcmd.txt")
144 (*step.getEnv())["GITHUB_OUTPUT"] = path.Join(actPath, outputFileCommand)
145
146 stateFileCommand := path.Join("workflow", "statecmd.txt")
147 (*step.getEnv())["GITHUB_STATE"] = path.Join(actPath, stateFileCommand)
148
149 pathFileCommand := path.Join("workflow", "pathcmd.txt")
150 (*step.getEnv())["GITHUB_PATH"] = path.Join(actPath, pathFileCommand)
151

Callers 7

mainMethod · 0.85
mainMethod · 0.85
postMethod · 0.85
preMethod · 0.85
mainMethod · 0.85
postMethod · 0.85
mainMethod · 0.85

Calls 15

LoggerFunction · 0.92
JobCancelContextFunction · 0.92
makeFunction · 0.85
setupEnvFunction · 0.85
isStepEnabledFunction · 0.85
evaluateStepTimeoutFunction · 0.85
monitorJobCancellationFunction · 0.85
isContinueOnErrorFunction · 0.85
UpdateExtraPathMethod · 0.80
getRunContextMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…