Skip to content

Commit

Permalink
ci: fix the pr title check by trimming the title
Browse files Browse the repository at this point in the history
  • Loading branch information
camilamacedo86 committed Aug 24, 2024
1 parent 0021e87 commit efdb335
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 efdb335

Please sign in to comment.