@@ -27,7 +27,7 @@ import {
2727import { DefaultVersioningStrategy } from '../versioning-strategies/default' ;
2828import { DefaultChangelogNotes } from '../changelog-notes/default' ;
2929import { Update } from '../update' ;
30- import { ConventionalCommit , Commit } from '../commit' ;
30+ import { ConventionalCommit , Commit , parseConventionalCommits } from '../commit' ;
3131import { Version , VersionsMap } from '../version' ;
3232import { TagName } from '../util/tag-name' ;
3333import { Release } from '../release' ;
@@ -277,15 +277,35 @@ export abstract class BaseStrategy implements Strategy {
277277 draft,
278278 manifestPath,
279279 } : {
280- commits : ConventionalCommit [ ] ;
280+ commits : Commit [ ] ;
281281 latestRelease ?: Release ;
282282 draft ?: boolean ;
283283 labels ?: string [ ] ;
284284 existingPullRequest ?: PullRequest ;
285285 manifestPath ?: string ;
286286 } ) : Promise < ReleasePullRequest | undefined > {
287- const conventionalCommits = await this . postProcessCommits ( commits ) ;
288- this . logger . info ( `Considering: ${ commits . length } conventional commits` ) ;
287+ this . logger . info ( `Considering: ${ commits . length } raw commits` ) ;
288+
289+ const mergeCommitRegex =
290+ / ^ M e r g e p u l l r e q u e s t # \d + f r o m [ ^ / ] + \/ r e l e a s e - p l e a s e ( - - [ \w - ] + ) + $ / ;
291+
292+ // if there are no commits that are not release pr merge commits, there's nothing to include in a new release PR
293+ if ( commits . every ( c => mergeCommitRegex . test ( c . message ) ) ) {
294+ this . logger . info (
295+ `No commits to consider for ${ this . path } , all commits are merges of release PRs`
296+ ) ;
297+ return ;
298+ }
299+
300+ // do not parse commits if they are already conventional commits
301+ let conventionalCommits =
302+ commits [ 0 ] && 'type' in commits [ 0 ]
303+ ? ( commits as ConventionalCommit [ ] )
304+ : parseConventionalCommits ( commits , this . logger ) ;
305+ conventionalCommits = await this . postProcessCommits ( conventionalCommits ) ;
306+ this . logger . info (
307+ `Considering: ${ conventionalCommits . length } conventional commits`
308+ ) ;
289309
290310 const component = await this . getComponent ( ) ;
291311 this . logger . debug ( 'component:' , component ) ;
0 commit comments