From efdb3350cafac3ca4e8a116978db15b8cb9dc0fd Mon Sep 17 00:00:00 2001 From: Camila Macedo Date: Sat, 24 Aug 2024 11:35:13 +0100 Subject: [PATCH] ci: fix the pr title check by trimming the title --- hack/ci/pr_title_checker.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/hack/ci/pr_title_checker.sh b/hack/ci/pr_title_checker.sh index a9353ea1144..88550f7af7b 100755 --- a/hack/ci/pr_title_checker.sh +++ b/hack/ci/pr_title_checker.sh @@ -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"