@@ -134,25 +134,80 @@ class Generator {
134
134
return typeMap ;
135
135
}
136
136
137
+ public getGithubIssue (
138
+ issueId : number ,
139
+ resourceLink : TypeResourcePrefix ,
140
+ context : GeneratorContext ,
141
+ removePrefix : boolean
142
+ ) {
143
+ const ghIssue = context . issues . get ( issueId ) ;
144
+
145
+ if ( ghIssue ) {
146
+ const link = this . getIssueLink ( ghIssue , context . config ) ;
147
+ return removePrefix ? link : `${ resourceLink . issue } ${ link } ` ;
148
+ }
149
+
150
+ return undefined ;
151
+ }
152
+
153
+ public getGithubPr (
154
+ prId : number ,
155
+ resourceLink : TypeResourcePrefix ,
156
+ context : GeneratorContext ,
157
+ removePrefix : boolean
158
+ ) {
159
+ const ghPr = context . pullRequests . get ( prId ) ;
160
+
161
+ if ( ghPr ) {
162
+ const link = this . getPrLink ( ghPr , context . config ) ;
163
+ return removePrefix ? link : `${ resourceLink . pullRequest } ${ link } ` ;
164
+ }
165
+
166
+ return undefined ;
167
+ }
168
+
137
169
public getGithubMeta ( entry : ChangelogEntry , context : GeneratorContext ) {
138
170
const builder = new MarkdownBuilder ( ) ;
139
171
const resourceLink = this . getResourceLink ( context . config , entry . type ) ;
172
+
140
173
if ( entry . issue !== undefined ) {
141
- const ghIssue = context . issues . get ( entry . issue ) ;
174
+ const isMultiple = Array . isArray ( entry . issue ) ;
175
+ const issueIds : number [ ] = Array . isArray ( entry . issue )
176
+ ? entry . issue
177
+ : [ entry . issue ] ;
142
178
143
- if ( ghIssue ) {
144
- builder . addSubListItem (
145
- `${ resourceLink . issue } ${ this . getIssueLink ( ghIssue , context . config ) } `
179
+ if ( isMultiple && resourceLink ?. issue ) {
180
+ builder . addSubListItem ( resourceLink . issue ) ;
181
+ }
182
+
183
+ for ( const issueId of issueIds ) {
184
+ const issue = this . getGithubIssue (
185
+ issueId ,
186
+ resourceLink ,
187
+ context ,
188
+ isMultiple
146
189
) ;
190
+ if ( issue ) {
191
+ builder . addSubListItem ( issue , isMultiple ) ;
192
+ }
147
193
}
148
194
}
149
195
150
196
if ( entry . pullRequest !== undefined ) {
151
- const ghPr = context . pullRequests . get ( entry . pullRequest ) ;
152
- if ( ghPr ) {
153
- builder . addSubListItem (
154
- `${ resourceLink . pullRequest } ${ this . getPrLink ( ghPr , context . config ) } `
155
- ) ;
197
+ const isMultiple = Array . isArray ( entry . pullRequest ) ;
198
+ const prIds : number [ ] = Array . isArray ( entry . pullRequest )
199
+ ? entry . pullRequest
200
+ : [ entry . pullRequest ] ;
201
+
202
+ if ( isMultiple && resourceLink ?. pullRequest ) {
203
+ builder . addSubListItem ( resourceLink . pullRequest ) ;
204
+ }
205
+
206
+ for ( const prId of prIds ) {
207
+ const pr = this . getGithubPr ( prId , resourceLink , context , isMultiple ) ;
208
+ if ( pr ) {
209
+ builder . addSubListItem ( pr , isMultiple ) ;
210
+ }
156
211
}
157
212
}
158
213
0 commit comments