GH-704 - Attempt cherry-pick before creating the ticket.

This commit is contained in:
Oliver Drotbohm
2024-07-14 19:26:06 +02:00
parent 8369eec305
commit 780e4bcaaa

View File

@@ -13,21 +13,20 @@ number=$1
# For each of the target versions
for version in ${@:2}
do
echo "gh issue create --title \"$title\" --body \"Back-port of $sourceGh.\" --label \"$labels\" --assignee \"@me\" --milestone \"$version\""
number=$(gh issue create --title "$title" --body "Back-port of $sourceGh." --label "$labels" --assignee "@me" --milestone "$version" | awk -F '/' '{print $NF}')
echo "New ticket number: $number"
# Turn 1.5.6 into 1.5.x
targetBranch="$(echo "$version" | grep -oE '^[0-9]+\.[0-9]+').x"
# Checkout target branch and cherry-pick commit
echo "Checking out branch $targetBranch"
git checkout $targetBranch
echo "Cherry-pick commit from $branch"
git cherry-pick $branch
echo "gh issue create --title \"$title\" --body \"Back-port of $sourceGh.\" --label \"$labels\" --assignee \"@me\" --milestone \"$version\""
number=$(gh issue create --title "$title" --body "Back-port of $sourceGh." --label "$labels" --assignee "@me" --milestone "$version" | awk -F '/' '{print $NF}')
echo "New ticket number: $number"
# Replace ticket reference with new one
targetGh="GH-$number"
expression="s/$sourceGh/$targetGh/g"