Browse Source

Enhance release notes processing with aggressive cleaning

Updated the script to use aggressive cleaning on raw release notes and improved the filtering logic for better output.
pull/24834/head
selman koc 4 months ago
committed by GitHub
parent
commit
43fc3f1390
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 56
      .github/workflows/update-studio-docs.yml

56
.github/workflows/update-studio-docs.yml

@ -197,42 +197,58 @@ jobs:
echo "✅ Using AI-formatted release notes" echo "✅ Using AI-formatted release notes"
echo "$AI_RESPONSE" > .tmp/final-notes.txt echo "$AI_RESPONSE" > .tmp/final-notes.txt
else else
echo "⚠️ AI unavailable - using raw release notes with cleaning" echo "⚠️ AI unavailable - using aggressive cleaning on raw release notes"
# Clean and format raw notes # Clean and format raw notes with aggressive filtering
echo "$RAW_NOTES" | while IFS= read -r line; do echo "$RAW_NOTES" | while IFS= read -r line; do
# Skip empty lines # Skip empty lines
[ -z "$line" ] && continue [ -z "$line" ] && continue
# Skip GitHub PR metadata lines # Skip section headers
[[ "$line" =~ ^(Full\ Changelog|\*\*Full\ Changelog) ]] && continue [[ "$line" =~ ^#+.*What.*Changed ]] && continue
[[ "$line" =~ ^##[[:space:]] ]] && continue
# Clean GitHub username mentions (@username -> username) # Skip full changelog links
line=$(echo "$line" | sed 's/@\([a-zA-Z0-9_-]*\)/\1/g') [[ "$line" =~ ^\*\*Full\ Changelog ]] && continue
[[ "$line" =~ ^Full\ Changelog ]] && continue
# Clean GitHub PR/issue links - extract just the description # Remove leading bullet/asterisk
line=$(echo "$line" | sed 's#in https://github.com/[^[:space:]]*##g') line=$(echo "$line" | sed 's/^[[:space:]]*[*-][[:space:]]*//')
line=$(echo "$line" | sed 's#by [a-zA-Z0-9_-]* in##g')
# Clean extra "by username" mentions # Aggressive cleaning: remove entire " by @user in https://..." suffix
line=$(echo "$line" | sed 's/by [a-zA-Z0-9_-]*$//g') line=$(echo "$line" | sed 's/[[:space:]]*by @[a-zA-Z0-9_-]*[[:space:]]*in https:\/\/github\.com\/[^[:space:]]*//g')
# Trim whitespace # Remove remaining "by @username" or "by username"
line=$(echo "$line" | sed 's/[[:space:]]*by @[a-zA-Z0-9_-]*[[:space:]]*$//g')
line=$(echo "$line" | sed 's/[[:space:]]*by [a-zA-Z0-9_-]*[[:space:]]*$//g')
# Remove standalone @mentions
line=$(echo "$line" | sed 's/@[a-zA-Z0-9_-]*//g')
# Clean trailing periods if orphaned
line=$(echo "$line" | sed 's/\.[[:space:]]*$//')
# Trim all whitespace
line=$(echo "$line" | sed 's/^[[:space:]]*//;s/[[:space:]]*$//') line=$(echo "$line" | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')
# Skip if line is now empty # Skip if line is empty or too short
[ -z "$line" ] && continue [ -z "$line" ] && continue
[ ${#line} -lt 5 ] && continue
# Add bullet if not present # Capitalize first letter if lowercase
if [[ ! "$line" =~ ^[[:space:]]*[-*] ]]; then line="$(echo ${line:0:1} | tr '[:lower:]' '[:upper:]')${line:1}"
echo "- $line"
else # Add clean bullet and output
# Normalize to dash echo "- $line"
echo "$line" | sed 's/^[[:space:]]*\*/- /'
fi
done > .tmp/final-notes.txt done > .tmp/final-notes.txt
fi fi
# Safety check: verify we have content
if [ ! -s .tmp/final-notes.txt ]; then
echo "⚠️ No valid release notes extracted, using minimal fallback"
echo "- Release ${{ steps.payload.outputs.version }}" > .tmp/final-notes.txt
fi
echo "=== Final release notes ===" echo "=== Final release notes ==="
cat .tmp/final-notes.txt cat .tmp/final-notes.txt
echo "===========================" echo "==========================="

Loading…
Cancel
Save