Skip to content

Commit 551f921

Browse files
author
Keith
committed
ci(release): improve fallback release note wording
1 parent 9c9ba7c commit 551f921

1 file changed

Lines changed: 27 additions & 1 deletion

File tree

scripts/generate-release-notes.sh

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,22 @@ normalize_remote_url() {
4949
esac
5050
}
5151

52+
subject_highlight() {
53+
local subject="$1"
54+
subject="$(printf '%s' "$subject" | sed -E 's/^[a-z]+(\([^)]+\))?:[[:space:]]*//')"
55+
printf '%s' "$subject" | awk '
56+
{
57+
line = $0
58+
if (length(line) == 0) next
59+
first = substr(line, 1, 1)
60+
rest = substr(line, 2)
61+
line = toupper(first) rest
62+
if (line !~ /[.!?]$/) line = line "."
63+
print line
64+
}
65+
'
66+
}
67+
5268
TAG="${1:-${GITHUB_REF_NAME:-}}"
5369
OUT_PATH="${2:-$ROOT_DIR/dist/release-notes.md}"
5470

@@ -108,7 +124,17 @@ fi
108124
printf '%s\n\n' "$UNRELEASED_SECTION"
109125
printf '_Source: `docs/CHANGELOG.md` `Unreleased` section at tag time._\n\n'
110126
else
111-
printf 'No curated changelog entry was present for this tag, so the notes below are generated from the exact tagged commit range.\n\n'
127+
if [[ -z "$COMMITS" ]]; then
128+
printf '- No recorded changes found for `%s`.\n\n' "$TAG"
129+
else
130+
while IFS=$'\t' read -r sha subject; do
131+
highlight="$(subject_highlight "$subject")"
132+
if [[ -n "$highlight" ]]; then
133+
printf -- '- %s\n' "$highlight"
134+
fi
135+
done <<<"$COMMITS"
136+
printf '\n'
137+
fi
112138
fi
113139

114140
printf '## Included Commits\n\n'

0 commit comments

Comments
 (0)