File tree Expand file tree Collapse file tree 1 file changed +15
-3
lines changed
Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -121,10 +121,22 @@ export default class Jira {
121121 // Add jira tickets to log
122122 const tickets = await Promise . all ( promises )
123123
124- log . tickets = tickets
125- . flatMap ( ( ticket ) => ( ticket ?. fields ?. issuetype ?. subtask ? [ ticket , ticket . fields . parent ] : ticket ) )
126- . filter ( ( t ) => t && this . includeTicket ( t ) )
124+ // For each subtask ticket, fetch the parent ticket if it already hasn't been
125+ const parentPromises = [ ]
126+ tickets . forEach ( ( ticket ) => {
127+ if ( ticket ?. fields ?. issuetype ?. subtask ) {
128+ const parentKey = ticket ?. fields ?. parent ?. key
129+ if ( found [ parentKey ] ) {
130+ return
131+ }
132+ found [ parentKey ] = true
133+ parentPromises . push ( this . fetchJiraTicket ( parentKey ) )
134+ }
135+ } )
136+ const parentTickets = await Promise . all ( parentPromises )
127137
138+ // Add found jira tickets and their parent tickets to log
139+ log . tickets = tickets . concat ( parentTickets ) . filter ( ( t ) => t && this . includeTicket ( t ) )
128140 return log
129141 }
130142
You can’t perform that action at this time.
0 commit comments