Skip to content

Commit

Permalink
fix(presets): use proper handling as before
Browse files Browse the repository at this point in the history
Now revert last changes which used for tests passing as a temporarily and now using proper way
  • Loading branch information
dalisoft committed Apr 25, 2024
1 parent 2c292ce commit bb75142
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 22 deletions.
19 changes: 9 additions & 10 deletions presets/conventional-commits.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ RELEASE_SKIP_TYPES=("build" "chore" "docs" "test" "style" "ci" "skip ci")
RELEASE_PATCH_TYPES=("fix" "close" "closes" "perf" "revert")
# shellcheck disable=2034
RELEASE_MINOR_TYPES=("refactor" "feat")
# shellcheck disable=2034
RELEASE_MAJOR_TYPES=("BREAKING CHANGE")

INCLUDE_SCOPE=("refactor" "perf" "revert")

Expand Down Expand Up @@ -41,25 +43,17 @@ parse_commit() {
description="${BASH_REMATCH[4]}"

type="BREAKING CHANGE"

if ! $MAJOR_UPGRADED; then
MAJOR_UPGRADED=true
RELEASE_BODY+="\n## BREAKING CHANGES\n\n"
fi
fi

# Extract body
if [[ "$body" =~ $string_commit_major ]]; then
description="$subject"

type="BREAKING CHANGE"
fi

if ! $MAJOR_UPGRADED; then
MAJOR_UPGRADED=true
RELEASE_BODY+="\n## BREAKING CHANGES\n\n"
fi
# Handle other type of commits
elif is_valid_commit_type "$type" "${RELEASE_SKIP_TYPES[@]}"; then
if is_valid_commit_type "$type" "${RELEASE_SKIP_TYPES[@]}"; then
return 0
elif is_valid_commit_type "$type" "${RELEASE_PATCH_TYPES[@]}"; then
if ! $PATCH_UPGRADED; then
Expand All @@ -71,6 +65,11 @@ parse_commit() {
MINOR_UPGRADED=true
RELEASE_BODY+="\n## Features\n\n"
fi
elif is_valid_commit_type "$type" "${RELEASE_MAJOR_TYPES[@]}"; then
if ! $MAJOR_UPGRADED; then
MAJOR_UPGRADED=true
RELEASE_BODY+="\n## BREAKING CHANGES\n\n"
fi
fi

RELEASE_BODY+="- "
Expand Down
23 changes: 11 additions & 12 deletions presets/workspace.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ RELEASE_SKIP_TYPES=("build" "chore" "docs" "test" "style" "ci" "skip ci")
RELEASE_PATCH_TYPES=("fix" "close" "closes" "perf" "revert")
# shellcheck disable=2034
RELEASE_MINOR_TYPES=("refactor" "feat")
# shellcheck disable=2034
RELEASE_MAJOR_TYPES=("BREAKING CHANGE")

INCLUDE_SCOPE=("refactor" "perf" "revert")

Expand Down Expand Up @@ -41,11 +43,6 @@ parse_commit() {
description="${BASH_REMATCH[4]}"

type="BREAKING CHANGE"

if ! $MAJOR_UPGRADED; then
MAJOR_UPGRADED=true
RELEASE_BODY+="\n## BREAKING CHANGES\n\n"
fi
fi

# Early catching non-workspace commits
Expand All @@ -55,16 +52,13 @@ parse_commit() {

# Extract body
if [[ "$body" =~ $string_commit_major ]]; then
type="BREAKING CHANGE"

description="$subject"

if ! $MAJOR_UPGRADED; then
MAJOR_UPGRADED=true
RELEASE_BODY+="\n## BREAKING CHANGES\n\n"
fi
type="BREAKING CHANGE"
fi

# Handle other type of commits
elif is_valid_commit_type "$type" "${RELEASE_SKIP_TYPES[@]}"; then
if is_valid_commit_type "$type" "${RELEASE_SKIP_TYPES[@]}"; then
return 0
elif is_valid_commit_type "$type" "${RELEASE_PATCH_TYPES[@]}"; then
if ! $PATCH_UPGRADED; then
Expand All @@ -76,6 +70,11 @@ parse_commit() {
MINOR_UPGRADED=true
RELEASE_BODY+="\n## Features\n\n"
fi
elif is_valid_commit_type "$type" "${RELEASE_MAJOR_TYPES[@]}"; then
if ! $MAJOR_UPGRADED; then
MAJOR_UPGRADED=true
RELEASE_BODY+="\n## BREAKING CHANGES\n\n"
fi
fi

if is_valid_commit_type "$type" "${INCLUDE_SCOPE[@]}"; then
Expand Down

0 comments on commit bb75142

Please sign in to comment.