Skip to content

Commit

Permalink
🌱 ci: Normalize text-based emoji codes to actual emojis in PR title c…
Browse files Browse the repository at this point in the history
…hecker (#4097)

ci: Normalize text-based emoji codes to actual emojis in PR title checker

Follow up of: #4095
  • Loading branch information
camilamacedo86 authored Aug 24, 2024
1 parent 547b2f3 commit eb0f00b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions hack/ci/pr_title_checker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@ PR_TITLE="$1"
# Trim WIP and tags from title
trimmed_title=$(echo "$PR_TITLE" | sed -E "s/$WIP_REGEX//" | sed -E "s/$TAG_REGEX//" | xargs)

# Normalize common emojis in text form to actual emojis
trimmed_title=$(echo "$trimmed_title" | sed -E "s/:warning:/⚠/g")
trimmed_title=$(echo "$trimmed_title" | sed -E "s/:sparkles:/✨/g")
trimmed_title=$(echo "$trimmed_title" | sed -E "s/:bug:/🐛/g")
trimmed_title=$(echo "$trimmed_title" | sed -E "s/:book:/📖/g")
trimmed_title=$(echo "$trimmed_title" | sed -E "s/:rocket:/🚀/g")
trimmed_title=$(echo "$trimmed_title" | sed -E "s/:seedling:/🌱/g")

# Check PR type prefix
if [[ "$trimmed_title" =~ ^⚠ ]] || [[ "$trimmed_title" =~ ^✨ ]] || [[ "$trimmed_title" =~ ^🐛 ]] || [[ "$trimmed_title" =~ ^📖 ]] || [[ "$trimmed_title" =~ ^🚀 ]] || [[ "$trimmed_title" =~ ^🌱 ]]; then
echo "PR title is valid: $trimmed_title"
Expand Down

0 comments on commit eb0f00b

Please sign in to comment.