Skip to content

Commit

Permalink
fix(presets): early-catching for performance and bug reasons
Browse files Browse the repository at this point in the history
  • Loading branch information
dalisoft committed Apr 25, 2024
1 parent 5cebfb9 commit d5bfaba
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 5 additions & 1 deletion presets/conventional-commits.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,12 @@ parse_commit() {
type="BREAKING CHANGE"
scope="${BASH_REMATCH[3]}"
description="${BASH_REMATCH[4]}"
else
return 0
fi

# Extract body
if [[ "$body" =~ $string_commit_major ]]; then
if [[ -n "$body" && "$body" =~ $string_commit_major ]]; then
type="BREAKING CHANGE"
description="$subject"
fi
Expand All @@ -67,6 +69,8 @@ parse_commit() {
MAJOR_UPGRADED=true
RELEASE_BODY+="\n## BREAKING CHANGES\n\n"
fi
else
return 0
fi

RELEASE_BODY+="- "
Expand Down
6 changes: 3 additions & 3 deletions presets/workspace.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ parse_commit() {
type="${BASH_REMATCH[1]}"
scope="${BASH_REMATCH[3]}"
description="${BASH_REMATCH[4]}"

elif [[ "$subject" =~ $regexp_commit_major ]]; then
type="BREAKING CHANGE"
scope="${BASH_REMATCH[3]}"
description="${BASH_REMATCH[4]}"

else
return 0
fi

# Early catching non-workspace commits
Expand All @@ -50,7 +50,7 @@ parse_commit() {
fi

# Extract body
if [[ "$body" =~ $string_commit_major ]]; then
if [[ -n "$body" && "$body" =~ $string_commit_major ]]; then
type="BREAKING CHANGE"
description="$subject"
fi
Expand Down

0 comments on commit d5bfaba

Please sign in to comment.