Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions scripts/conventional.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,16 @@ determine_bump() {
local bump="none"

while IFS= read -r message; do
# Check for breaking changes
# Check for breaking changes — major wins; finish consuming stdin so the
# upstream pipeline doesn't get EPIPE on its remaining writes.
if [[ "$message" =~ ^[a-zA-Z]+(\(.+\))?!: ]] || [[ "$message" =~ BREAKING[[:space:]]CHANGE ]]; then
echo "major"
return
bump="major"
continue
fi

# Skip further checks once we've locked in major.
if [[ "$bump" == "major" ]]; then
continue
fi

# Check for features
Expand Down
13 changes: 13 additions & 0 deletions tests/conventional.bats
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,19 @@ setup() {
[[ "$result" == "major" ]]
}

@test "determine_bump: consumes the full stream after locking in major (no SIGPIPE)" {
# Producer pipeline that mirrors create-release-pr.sh — many lines piped in,
# with the breaking change up front. If determine_bump returns early, the
# remaining echos hit a closed pipe and emit "Broken pipe" on stderr.
err=$(
{
echo "feat!: break stuff"
for i in $(seq 1 50); do echo "fix: thing ${i}"; done
} | determine_bump 2>&1 >/dev/null
)
Comment on lines +71 to +76
[[ -z "$err" ]]
}

@test "determine_bump: none for non-conventional commits" {
result=$(echo "update readme" | determine_bump)
[[ "$result" == "none" ]]
Expand Down