@@ -3,9 +3,11 @@ package runner
3
3
import (
4
4
"context"
5
5
"fmt"
6
+ "path"
6
7
"strings"
7
8
8
9
"github.com/nektos/act/pkg/common"
10
+ "github.com/nektos/act/pkg/container"
9
11
"github.com/nektos/act/pkg/exprparser"
10
12
"github.com/nektos/act/pkg/model"
11
13
)
@@ -94,6 +96,20 @@ func runStepExecutor(step step, stage stepStage, executor common.Executor) commo
94
96
}
95
97
logger .Infof ("\u2B50 Run %s %s" , stage , stepString )
96
98
99
+ // Prepare and clean Runner File Commands
100
+ actPath := rc .JobContainer .GetActPath ()
101
+ outputFileCommand := path .Join ("workflow" , "outputcmd.txt" )
102
+ stateFileCommand := path .Join ("workflow" , "statecmd.txt" )
103
+ (* step .getEnv ())["GITHUB_OUTPUT" ] = path .Join (actPath , outputFileCommand )
104
+ (* step .getEnv ())["GITHUB_STATE" ] = path .Join (actPath , stateFileCommand )
105
+ _ = rc .JobContainer .Copy (actPath , & container.FileEntry {
106
+ Name : outputFileCommand ,
107
+ Mode : 0666 ,
108
+ }, & container.FileEntry {
109
+ Name : stateFileCommand ,
110
+ Mode : 0666 ,
111
+ })(ctx )
112
+
97
113
err = executor (ctx )
98
114
99
115
if err == nil {
@@ -117,6 +133,27 @@ func runStepExecutor(step step, stage stepStage, executor common.Executor) commo
117
133
118
134
logger .WithField ("stepResult" , rc .StepResults [rc .CurrentStep ].Outcome ).Errorf (" \u274C Failure - %s %s" , stage , stepString )
119
135
}
136
+ // Process Runner File Commands
137
+ orgerr := err
138
+ state := map [string ]string {}
139
+ err = rc .JobContainer .UpdateFromEnv (path .Join (actPath , stateFileCommand ), & state )(ctx )
140
+ if err != nil {
141
+ return err
142
+ }
143
+ for k , v := range state {
144
+ rc .saveState (ctx , map [string ]string {"name" : k }, v )
145
+ }
146
+ output := map [string ]string {}
147
+ err = rc .JobContainer .UpdateFromEnv (path .Join (actPath , outputFileCommand ), & output )(ctx )
148
+ if err != nil {
149
+ return err
150
+ }
151
+ for k , v := range output {
152
+ rc .setOutput (ctx , map [string ]string {"name" : k }, v )
153
+ }
154
+ if orgerr != nil {
155
+ return orgerr
156
+ }
120
157
return err
121
158
}
122
159
}
0 commit comments