11import { isUndefined } from "lodash-es" ;
2- import { sync as parser } from "conventional-commits-parser" ;
3- import filter from "conventional-commits-filter" ;
2+ import { CommitParser } from "conventional-commits-parser" ;
3+ import { filterRevertedCommitsSync } from "conventional-commits-filter" ;
44import debugFactory from "debug" ;
55import loadParserConfig from "./lib/load-parser-config.js" ;
66import loadReleaseRules from "./lib/load-release-rules.js" ;
@@ -31,7 +31,8 @@ export async function analyzeCommits(pluginConfig, context) {
3131 const config = await loadParserConfig ( pluginConfig , context ) ;
3232 let releaseType = null ;
3333
34- filter (
34+ const parser = new CommitParser ( config ) ;
35+ const filteredCommits = filterRevertedCommitsSync (
3536 commits
3637 . filter ( ( { message, hash } ) => {
3738 if ( ! message . trim ( ) ) {
@@ -41,8 +42,15 @@ export async function analyzeCommits(pluginConfig, context) {
4142
4243 return true ;
4344 } )
44- . map ( ( { message, ...commitProps } ) => ( { rawMsg : message , message, ...commitProps , ...parser ( message , config ) } ) )
45- ) . every ( ( { rawMsg, ...commit } ) => {
45+ . map ( ( { message, ...commitProps } ) => ( {
46+ rawMsg : message ,
47+ message,
48+ ...commitProps ,
49+ ...parser . parse ( message ) ,
50+ } ) )
51+ ) ;
52+
53+ for ( const { rawMsg, ...commit } of filteredCommits ) {
4654 logger . log ( `Analyzing commit: %s` , rawMsg ) ;
4755 let commitReleaseType ;
4856
@@ -71,11 +79,10 @@ export async function analyzeCommits(pluginConfig, context) {
7179
7280 // Break loop if releaseType is the highest
7381 if ( releaseType === RELEASE_TYPES [ 0 ] ) {
74- return false ;
82+ break ;
7583 }
84+ }
7685
77- return true ;
78- } ) ;
7986 logger . log ( "Analysis of %s commits complete: %s release" , commits . length , releaseType || "no" ) ;
8087
8188 return releaseType ;
0 commit comments