@@ -93,6 +93,13 @@ type SimpleWorkflowRun struct {
9393 CheckSuiteNodeID string
9494}
9595
96+ // DbCheckRun is used to store additional fields (like RunId) required for database storage
97+ // and application logic, while embedding the GraphqlQueryCheckRun struct for API data.
98+ type DbCheckRun struct {
99+ RunId int // WorkflowRunId, required for DORA calculation
100+ * GraphqlQueryCheckRun
101+ }
102+
96103var CollectJobsMeta = plugin.SubTaskMeta {
97104 Name : "Collect Job Runs" ,
98105 EntryPoint : CollectJobs ,
@@ -188,15 +195,20 @@ func CollectJobs(taskCtx plugin.SubTaskContext) errors.Error {
188195 ResponseParser : func (queryWrapper any ) (messages []json.RawMessage , err errors.Error ) {
189196 query := queryWrapper .(* GraphqlQueryCheckRunWrapper )
190197 for _ , node := range query .Node {
198+ runId := node .CheckSuite .WorkflowRun .DatabaseId
191199 for _ , checkRun := range node .CheckSuite .CheckRuns .Nodes {
192- updatedAt := checkRun .StartedAt
193- if checkRun .CompletedAt != nil {
194- updatedAt = checkRun .CompletedAt
200+ dbCheckRun := & DbCheckRun {
201+ RunId : runId ,
202+ GraphqlQueryCheckRun : & checkRun ,
203+ }
204+ updatedAt := dbCheckRun .StartedAt
205+ if dbCheckRun .CompletedAt != nil {
206+ updatedAt = dbCheckRun .CompletedAt
195207 }
196208 if apiCollector .GetSince () != nil && ! apiCollector .GetSince ().Before (* updatedAt ) {
197209 return messages , helper .ErrFinishCollect
198210 }
199- messages = append (messages , errors .Must1 (json .Marshal (checkRun )))
211+ messages = append (messages , errors .Must1 (json .Marshal (dbCheckRun )))
200212 }
201213 }
202214 return
0 commit comments