Skip to content

Commit

Permalink
feat: add job/step result status to skipped steps/jobs
Browse files Browse the repository at this point in the history
Co-authored-by: Markus Wolf <markus.wolf@new-work.se>
  • Loading branch information
2 people authored and github-actions committed May 24, 2022
1 parent 1d1b5d6 commit 43ae3de
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions pkg/runner/action.go
Original file line number Diff line number Diff line change
Expand Up @@ -526,17 +526,17 @@ func shouldRunPostStep(step actionStep) common.Conditional {
stepResult := stepResults[step.getStepModel().ID]

if stepResult == nil {
log.Debugf("skip post step for '%s'; step was not executed", step.getStepModel())
log.WithField("stepResult", model.StepStatusSkipped).Debugf("skipping 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())
log.WithField("stepResult", model.StepStatusSkipped).Debugf("skipping post step for '%s'; main step was skipped", step.getStepModel())
return false
}

if step.getActionModel() == nil {
log.Debugf("skip post step for '%s': no action model available", step.getStepModel())
log.WithField("stepResult", model.StepStatusSkipped).Debugf("skipping post step for '%s': no action model available", step.getStepModel())
return false
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/runner/run_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ func (rc *RunContext) isEnabled(ctx context.Context) (bool, error) {
return false, fmt.Errorf(" \u274C Error in if-expression: \"if: %s\" (%s)", job.If.Value, err)
}
if !runJob {
l.Debugf("Skipping job '%s' due to '%s'", job.Name, job.If.Value)
l.WithField("jobResult", "skipped").Debugf("Skipping job '%s' due to '%s'", job.Name, job.If.Value)
return false, nil
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/runner/step.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func runStepExecutor(step step, stage stepStage, executor common.Executor) commo
if !runStep {
rc.StepResults[rc.CurrentStep].Conclusion = model.StepStatusSkipped
rc.StepResults[rc.CurrentStep].Outcome = model.StepStatusSkipped
logger.Debugf("Skipping step '%s' due to '%s'", stepModel, ifExpression)
logger.WithField("stepResult", rc.StepResults[rc.CurrentStep].Outcome).Debugf("Skipping step '%s' due to '%s'", stepModel, ifExpression)
return nil
}

Expand Down

0 comments on commit 43ae3de

Please sign in to comment.