Skip to content

Commit f3cb98a

Browse files
committed
fix shellcheck
1 parent ae4e4d3 commit f3cb98a

File tree

1 file changed

+14
-17
lines changed

1 file changed

+14
-17
lines changed

.github/scripts/format-release-notes.sh

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,29 +16,26 @@ if [[ ! -f "$changelog_section" ]]; then
1616
exit 1
1717
fi
1818

19-
# Create temporary file to collect all output
20-
temp_file=$(mktemp)
21-
22-
# Add breaking changes section if it exists
23-
if grep -q "### ⚠️ Breaking Changes" "$changelog_section"; then
24-
cat << 'EOF' >> "$temp_file"
19+
# Generate all output and redirect to file at once
20+
{
21+
# Add breaking changes section if it exists
22+
if grep -q "### ⚠️ Breaking Changes" "$changelog_section"; then
23+
cat << 'EOF'
2524
2625
## 🚨 IMPORTANT: Breaking Changes
2726
2827
This release contains breaking changes. Please review the changes below:
2928
3029
EOF
3130

32-
# Extract breaking changes section, format for release notes
33-
sed -n '/### ⚠️ Breaking Changes/,/^### /p' "$changelog_section" | sed '$d' | \
34-
perl -0pe 's/(?<!\n)\n *(?!\n)(?![-*] )(?![1-9]+\. )/ /g' >> "$temp_file"
35-
36-
echo -e "\n---\n" >> "$temp_file"
37-
fi
31+
# Extract breaking changes section, format for release notes
32+
sed -n '/### ⚠️ Breaking Changes/,/^### /p' "$changelog_section" | sed '$d' | \
33+
perl -0pe 's/(?<!\n)\n *(?!\n)(?![-*] )(?![1-9]+\. )/ /g'
3834

39-
# the complex perl regex is needed because markdown docs render newlines as soft wraps
40-
# while release notes render them as line breaks
41-
perl -0pe 's/(?<!\n)\n *(?!\n)(?![-*] )(?![1-9]+\. )/ /g' "$changelog_section" >> "$temp_file"
35+
echo -e "\n---\n"
36+
fi
4237

43-
# Move temp file to final output
44-
mv "$temp_file" "$output_file"
38+
# the complex perl regex is needed because markdown docs render newlines as soft wraps
39+
# while release notes render them as line breaks
40+
perl -0pe 's/(?<!\n)\n *(?!\n)(?![-*] )(?![1-9]+\. )/ /g' "$changelog_section"
41+
} > "$output_file"

0 commit comments

Comments
 (0)