@@ -25,12 +25,23 @@ func FullSteps(task *actions_model.ActionTask) []*actions_model.ActionTaskStep {
2525 // 3. preStep(Success) -> step1(Running) -> step2(Waiting) -> postStep(Waiting): firstStep is step1.
2626 // 3. preStep(Success) -> step1(Skipped) -> step2(Skipped) -> postStep(Skipped): firstStep is nil.
2727 var firstStep * actions_model.ActionTaskStep
28+ // lastHasRunStep is the last step that has run.
29+ // For example,
30+ // 1. preStep(Success) -> step1(Success) -> step2(Running) -> step3(Waiting) -> postStep(Waiting): lastHasRunStep is step1.
31+ // 2. preStep(Success) -> step1(Success) -> step2(Success) -> step3(Success) -> postStep(Success): lastHasRunStep is step3.
32+ // 3. preStep(Success) -> step1(Success) -> step2(Failure) -> step3 -> postStep(Waiting): lastHasRunStep is step2.
33+ // So its Stopped is the Started of postStep when there are no more steps to run.
34+ var lastHasRunStep * actions_model.ActionTaskStep
35+
2836 var logIndex int64
2937 for _ , step := range task .Steps {
30- if step .Status .HasRun () || step .Status .IsRunning () {
38+ if firstStep == nil && ( step .Status .HasRun () || step .Status .IsRunning () ) {
3139 firstStep = step
32- break
3340 }
41+ if step .Status .HasRun () {
42+ lastHasRunStep = step
43+ }
44+ logIndex += step .LogLength
3445 }
3546
3647 preStep := & actions_model.ActionTaskStep {
@@ -50,19 +61,6 @@ func FullSteps(task *actions_model.ActionTask) []*actions_model.ActionTaskStep {
5061 }
5162 logIndex += preStep .LogLength
5263
53- // lastHasRunStep is the last step that has run.
54- // For example,
55- // 1. preStep(Success) -> step1(Success) -> step2(Running) -> step3(Waiting) -> postStep(Waiting): lastHasRunStep is step1.
56- // 2. preStep(Success) -> step1(Success) -> step2(Success) -> step3(Success) -> postStep(Success): lastHasRunStep is step3.
57- // 3. preStep(Success) -> step1(Success) -> step2(Failure) -> step3 -> postStep(Waiting): lastHasRunStep is step2.
58- // So its Stopped is the Started of postStep when there are no more steps to run.
59- var lastHasRunStep * actions_model.ActionTaskStep
60- for _ , step := range task .Steps {
61- if step .Status .HasRun () {
62- lastHasRunStep = step
63- }
64- logIndex += step .LogLength
65- }
6664 if lastHasRunStep == nil {
6765 lastHasRunStep = preStep
6866 }
0 commit comments