1
0
Fork 0
mirror of https://github.com/elementor/hello-theme.git synced 2026-07-27 14:01:37 +08:00
hello-theme/.github/scripts/cherry-picking/generate-pr-title.sh

18 lines
506 B
Bash
Executable file

#!/bin/bash
set -eo pipefail
PR_TITLE="$1"
PR_NUMBER="$2"
TARGET="$3"
PR_TICKETS=$(echo "$PR_TITLE" | grep -o '\[[A-Z]\{2,\}-[0-9]\+\]' | tr '\n' ' ' | sed 's/[[:space:]]*$//')
if [ -n "$PR_TICKETS" ]; then
TITLE_WITHOUT_TICKETS=$(echo "$PR_TITLE" | sed 's/\[[A-Z]\{2,\}-[0-9]\+\]//g' | sed 's/[[:space:]]*$//')
CHERRY_PICK_TITLE="$TITLE_WITHOUT_TICKETS (CP #${PR_NUMBER}${TARGET}) ${PR_TICKETS}"
else
CHERRY_PICK_TITLE="$PR_TITLE (CP #${PR_NUMBER}${TARGET})"
fi
echo "$CHERRY_PICK_TITLE"