diff --git a/src/semantic_release/changelog/context.py b/src/semantic_release/changelog/context.py index 563f6a3f4..202b2c373 100644 --- a/src/semantic_release/changelog/context.py +++ b/src/semantic_release/changelog/context.py @@ -169,6 +169,11 @@ def autofit_text_width(text: str, maxwidth: int = 100, indent_size: int = 0) -> ) ) + # Guard against empty paragraphs (e.g. from whitespace-only lines in commit bodies), + # which would cause words[0] to raise an IndexError. + if not words: + continue + # Initialize the line for each paragraph line = words[0] next_line = ""