Fix multiline changelog entries truncation in release news text generation
Problem
When generating release news text, multiline changelog entries were being truncated, losing important content on continuation lines. This affected the quality and completeness of release announcements.
Example of the issue:
A changelog entry like:
- Enh yiisoft/yii-dev-tool#47: Minor refactor `RequestBodyParser`: use `str_contains()` function instead of `strpos()` and `::class` instead
of `get_class()` (@vjik)
Was being rendered in news text as:
- Minor refactor `RequestBodyParser`: use `str_contains()` function instead of `strpos()` and `::class` instead
The continuation line of \get_class()`` was completely lost.
Root Cause
The issue was in the displayReleaseSummary() method in MakeCommand.php. The regex pattern used to extract changelog content:
preg_replace('~^-.*?:\s+(.*)\s+\(?.*?\)$~', '$1', $note)
Used the $ end-of-line anchor, which only matched single-line entries. When changelog entries contained newlines, the regex failed to match properly.
Solution
Replaced the problematic regex with a multiline-aware solution:
-
Enhanced regex with DOTALL modifier: Uses the
sflag to make.match newline characters - Robust pattern matching: More precisely handles different changelog entry formats
- Graceful fallback: If the primary pattern doesn't match, falls back to simple dash removal
// Extract the main message from changelog entry, handling multiline entries
$processed = preg_replace('~^-\s+[A-Za-z]+\s+[^:]*:\s+(.*?)\s*\([^)]*\)$~s', '$1', $note);
if ($processed === $note) {
// Pattern didn't match, fallback to simpler processing
$processed = preg_replace('~^-\s+~', '', $note);
}
Result
Multiline changelog entries are now fully preserved in release news text:
- Minor refactor `RequestBodyParser`: use `str_contains()` function instead of `strpos()` and `::class` instead
of `get_class()`
The fix maintains full backward compatibility with existing single-line entries while properly handling multiline content.
Fixes #47
[!WARNING]
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
https://api.github.com/repos/guzzle/psr7/zipball/21dc724a0583619cd1652f673303492272778051
- Triggering command:
/usr/bin/php8.3 -n -c /tmp/mqvUSi /usr/bin/composer install --no-dev(http block)https://api.github.com/repos/php-fig/http-factory/zipball/2b4765fddfe3b508ac62f829e852b1501d3f6e8a
- Triggering command:
/usr/bin/php8.3 -n -c /tmp/mqvUSi /usr/bin/composer install --no-dev(http block)https://api.github.com/repos/php-fig/http-message/zipball/402d35bcb92c70c026d1a6a9883f06b2ead23d71
- Triggering command:
/usr/bin/php8.3 -n -c /tmp/mqvUSi /usr/bin/composer install --no-dev(http block)https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822
- Triggering command:
/usr/bin/php8.3 -n -c /tmp/mqvUSi /usr/bin/composer install --no-dev(http block)https://api.github.com/repos/symfony/deprecation-contracts/zipball/63afe740e99a13ba87ec199bb07bbdee937a5b62
- Triggering command:
/usr/bin/php8.3 -n -c /tmp/mqvUSi /usr/bin/composer install --no-dev(http block)https://api.github.com/repos/symfony/polyfill-php80/zipball/0cc9dd0f17f61d8131e7df6b84bd344899fe2608
- Triggering command:
/usr/bin/php8.3 -n -c /tmp/mqvUSi /usr/bin/composer install --no-dev(http block)If you need me to access, download, or install something from one of these locations, you can either:
- Configure Actions setup steps to set up my environment, which run before the firewall is enabled
- Add the appropriate URLs or hosts to the custom allowlist in this repository's Copilot coding agent settings (admins only)
Original prompt
This section details on the original issue you should resolve
<issue_title>News text don't support multiline items from changelog</issue_title> <issue_description>Chaneglog:
- Enh yiisoft/yii-dev-tool#47: Minor refactor `RequestBodyParser`: use `str_contains()` function instead of `strpos()` and `::class` instead of `get_class()` (@vjik) - Bug yiisoft/yii-dev-tool#44: Explicitly mark nullable parameters (@vjik)in news text looks so:
- Minor refactor `RequestBodyParser`: use `str_contains()` function instead of `strpos()` and `::class` instead - Explicitly mark nullable parameters ```</issue_description> ## Comments on the Issue (you are @copilot in this section) <comments> </comments>
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.