@@ -19,6 +19,7 @@ import (
19
19
"code.gitea.io/actions-proto-go/runner/v1/runnerv1connect"
20
20
"github.com/bufbuild/connect-go"
21
21
gouuid "github.com/google/uuid"
22
+ "github.com/nektos/act/pkg/jobparser"
22
23
"google.golang.org/grpc/codes"
23
24
"google.golang.org/grpc/status"
24
25
)
@@ -109,12 +110,33 @@ func (s *Service) FetchTask(
109
110
task = t
110
111
}
111
112
113
+ if task != nil {
114
+ var workflowJob * jobparser.Job
115
+ if gots , err := jobparser .Parse (task .WorkflowPayload ); err != nil {
116
+ panic (err )
117
+ } else if len (gots ) != 1 {
118
+ panic (err )
119
+ } else {
120
+ _ , workflowJob = gots [0 ].Job ()
121
+ }
122
+ if workflowJob .Name == "job2" {
123
+ task .Needs = map [string ]* runnerv1.TaskNeed {
124
+ "job1" : {
125
+ Outputs : debugOutputs ,
126
+ Result : runnerv1 .Result_RESULT_SUCCESS ,
127
+ },
128
+ }
129
+ }
130
+ }
131
+
112
132
res := connect .NewResponse (& runnerv1.FetchTaskResponse {
113
133
Task : task ,
114
134
})
115
135
return res , nil
116
136
}
117
137
138
+ var debugOutputs = map [string ]string {}
139
+
118
140
// UpdateTask updates the task status.
119
141
func (s * Service ) UpdateTask (
120
142
ctx context.Context ,
@@ -145,6 +167,11 @@ func (s *Service) UpdateTask(
145
167
return nil , status .Errorf (codes .Internal , "update task: %v" , err )
146
168
}
147
169
170
+ for k , v := range req .Msg .Outputs {
171
+ log .Info ("task %d output %s: %s" , task .ID , k , v )
172
+ debugOutputs [k ] = v
173
+ }
174
+
148
175
if err := task .LoadJob (ctx ); err != nil {
149
176
return nil , status .Errorf (codes .Internal , "load job: %v" , err )
150
177
}
0 commit comments