File tree Expand file tree Collapse file tree 2 files changed +29
-7
lines changed Expand file tree Collapse file tree 2 files changed +29
-7
lines changed Original file line number Diff line number Diff line change @@ -164,5 +164,31 @@ describe("Changeset formatter", () => {
164164 `- third change ([#${ data . pull } ](https://github.com/${ data . repo } /pull/${ data . pull } ))\n\n**Credits**\nHuge thanks to @Gawdfrey for helping!`
165165 ) ;
166166 } ) ;
167+
168+ it ( "should combine authors from all changes" , async ( ) => {
169+ // First change with GitHub author
170+ const firstResult = await getReleaseLine (
171+ ...getChangeset ( "" , data . commit , false , "first change" )
172+ ) ;
173+ expect ( firstResult ) . toEqual (
174+ `- first change ([#${ data . pull } ](https://github.com/${ data . repo } /pull/${ data . pull } ))`
175+ ) ;
176+
177+ // Second change with explicit author
178+ const secondResult = await getReleaseLine (
179+ ...getChangeset ( "" , data . commit , false , "second change" )
180+ ) ;
181+ expect ( secondResult ) . toEqual (
182+ `- second change ([#${ data . pull } ](https://github.com/${ data . repo } /pull/${ data . pull } ))`
183+ ) ;
184+
185+ // Last change with multiple authors
186+ const lastResult = await getReleaseLine (
187+ ...getChangeset ( "" , data . commit , true , "third change" )
188+ ) ;
189+ expect ( lastResult ) . toEqual (
190+ `- third change ([#${ data . pull } ](https://github.com/${ data . repo } /pull/${ data . pull } ))\n\n**Credits**\nHuge thanks to @Gawdfrey for helping!`
191+ ) ;
192+ } ) ;
167193 } ) ;
168194} ) ;
Original file line number Diff line number Diff line change @@ -211,12 +211,8 @@ const wrappedGetReleaseLine: ChangelogFunctions["getReleaseLine"] = async (
211211 console . log ( `[Debug] Current authors: ${ Array . from ( allAuthors ) . join ( ", " ) } ` ) ;
212212 const result = await getReleaseLine ( changeset as ChangesetWithPR , type , opts ) ;
213213
214- // Add credits section to the last patch change
215- if ( type === "patch" && allAuthors . size > 0 ) {
216- isLastPatch = true ;
217- }
218-
219- if ( isLastPatch && type === "patch" && allAuthors . size > 0 ) {
214+ // Add credits section only to patch changes or when isLast is true
215+ if ( ( opts ?. isLast || type === "patch" ) && allAuthors . size > 0 ) {
220216 console . log ( `[Debug] Adding credits section for ${ type } changes` ) ;
221217 return result + getCreditsSection ( ) ;
222218 }
@@ -237,7 +233,7 @@ const wrappedGetDependencyReleaseLine: ChangelogFunctions["getDependencyReleaseL
237233 ) ;
238234
239235 // Add credits section only if this is the last entry and we have authors
240- if ( changesets . length === 0 && allAuthors . size > 0 ) {
236+ if ( opts ?. isLast && allAuthors . size > 0 ) {
241237 console . log ( `[Debug] Adding credits section for dependency changes` ) ;
242238 return result + getCreditsSection ( ) ;
243239 }
You can’t perform that action at this time.
0 commit comments