File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -27,10 +27,16 @@ jobs:
2727 MERGE_COMMIT=$(git --no-pager log -1 --merges --pretty=format:%H)
2828 echo "Merge commit: $MERGE_COMMIT"
2929
30- COMMIT_MESSAGE =$(git --no-pager show -s --pretty=%B $MERGE_COMMIT)
31- echo "Commit message : $COMMIT_MESSAGE "
30+ COMMIT_TITLE =$(git --no-pager show -s --pretty=%s " $MERGE_COMMIT" )
31+ echo "Commit title : $COMMIT_TITLE "
3232
33- SOURCE_BRANCH=$(echo "$COMMIT_MESSAGE" | grep -oE 'Merge branch .* into ' | sed -E 's/Merge branch (.*) into .*/\1/')
33+ if [[ "$COMMIT_TITLE" =~ ^Merge[[:space:]]branch[[:space:]](.+)[[:space:]]into[[:space:]].+$ ]]; then
34+ SOURCE_BRANCH="${BASH_REMATCH[1]}"
35+ elif [[ "$COMMIT_TITLE" =~ ^Merge[[:space:]]pull[[:space:]]request[[:space:]]#[0-9]+[[:space:]]from[[:space:]][^/]+/(.+)$ ]]; then
36+ SOURCE_BRANCH="${BASH_REMATCH[1]}"
37+ else
38+ SOURCE_BRANCH=""
39+ fi
3440
3541 if [[ -z "$SOURCE_BRANCH" ]]; then
3642 echo "Error: Unable to determine source branch."
You can’t perform that action at this time.
0 commit comments