File tree Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -28,7 +28,6 @@ while IFS= read -r line; do
2828 # Extract PR number from commit message
2929 if [[ $line =~ \( # ([0-9]+)\)$ ]]; then
3030 pr_number= " ${BASH_REMATCH[1]} "
31- commit_hash= $( echo " $line " | cut -d' ' -f1)
3231 commit_subject= $( echo " $line " | cut -d' ' -f2- | sed ' s/ (#[0-9]*)$//' )
3332
3433 # Check if this PR has the breaking change label using GitHub CLI
Original file line number Diff line number Diff line change @@ -16,9 +16,12 @@ if [[ ! -f "$changelog_section" ]]; then
1616 exit 1
1717fi
1818
19+ # Create temporary file to collect all output
20+ temp_file=$( mktemp)
21+
1922# Add breaking changes section if it exists
2023if grep -q " ### ⚠️ Breaking Changes" " $changelog_section " ; then
21- cat >> " $output_file " << 'EOF '
24+ cat << 'EOF ' >> "$temp_file"
2225
2326## 🚨 IMPORTANT: Breaking Changes
2427
2831
2932 # Extract breaking changes section, format for release notes
3033 sed -n ' /### ⚠️ Breaking Changes/,/^### /p' " $changelog_section " | sed ' $d' | \
31- perl -0pe ' s/(?<!\n)\n *(?!\n)(?![-*] )(?![1-9]+\. )/ /g' >> " $output_file "
34+ perl -0pe ' s/(?<!\n)\n *(?!\n)(?![-*] )(?![1-9]+\. )/ /g' >> " $temp_file "
3235
33- echo -e " \n---\n" >> " $output_file "
36+ echo -e " \n---\n" >> " $temp_file "
3437fi
3538
3639# the complex perl regex is needed because markdown docs render newlines as soft wraps
3740# while release notes render them as line breaks
38- perl -0pe ' s/(?<!\n)\n *(?!\n)(?![-*] )(?![1-9]+\. )/ /g' " $changelog_section " >> " $output_file "
41+ perl -0pe ' s/(?<!\n)\n *(?!\n)(?![-*] )(?![1-9]+\. )/ /g' " $changelog_section " >> " $temp_file "
42+
43+ # Move temp file to final output
44+ mv " $temp_file " " $output_file "
You can’t perform that action at this time.
0 commit comments