diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fada972..7b767ca 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -106,9 +106,33 @@ jobs: BOUNDARY=$(echo "$CANDIDATES" | xargs -I{} git log -1 --pretty="%ct %H" {} 2>/dev/null | sort -rn | head -1 | awk '{print $2}') echo "boundary=$BOUNDARY ($(git log -1 --pretty=%s "$BOUNDARY"))" - # `\(modal\)` matches scoped commits; `BREAKING[- ]CHANGE` matches - # the footer added by conventional-commits for breaking changes. - QUALIFY=$(git log "$BOUNDARY..HEAD" -E --grep='\(modal\)|BREAKING[- ]CHANGE' --pretty=%s || true) + # A commit qualifies if EITHER: + # - its subject (first line) has `(modal)` scope, OR + # - its body contains a line starting with `BREAKING CHANGE:` + # or `BREAKING-CHANGE:` (the conventional-commits footer). + # We can't use `git log --grep` here because that searches the + # entire commit message; a PR description that mentions + # "BREAKING CHANGE" in prose would falsely match. Iterate + # commits with a unit separator and check each part explicitly. + UNIT=$'\x1f' + REC=$'\x1e' + COMMITS=$(git log "$BOUNDARY..HEAD" --pretty=format:"%H${UNIT}%s${UNIT}%b${REC}") + QUALIFY="" + while IFS= read -r -d "$REC" entry; do + [ -z "$entry" ] && continue + sha=$(printf '%s' "$entry" | awk -F"$UNIT" '{print $1}') + subject=$(printf '%s' "$entry" | awk -F"$UNIT" '{print $2}') + body=$(printf '%s' "$entry" | awk -F"$UNIT" '{for(i=3;i<=NF;i++) printf "%s%s", $i, (i> "$GITHUB_OUTPUT"