Skip to content

Commit

Permalink
fix: do not run post step if no step result is available
Browse files Browse the repository at this point in the history
Having no step result means we do not run any step (neither pre
nor main) and we do not need to run post.
  • Loading branch information
KnisterPeter authored and github-actions committed May 23, 2022
1 parent 713bbd2 commit 7299d8f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkg/runner/action.go
Original file line number Diff line number Diff line change
Expand Up @@ -428,8 +428,14 @@ func shouldRunPostStep(step actionStep) common.Conditional {
return func(ctx context.Context) bool {
log := common.Logger(ctx)
stepResults := step.getRunContext().getStepsContext()
stepResult := stepResults[step.getStepModel().ID]

if stepResults[step.getStepModel().ID].Conclusion == model.StepStatusSkipped {
if stepResult == nil {
log.Debugf("skip post step for '%s'; step was not executed", step.getStepModel())
return false
}

if stepResult.Conclusion == model.StepStatusSkipped {
log.Debugf("skip post step for '%s'; main step was skipped", step.getStepModel())
return false
}
Expand Down

0 comments on commit 7299d8f

Please sign in to comment.