Getting targetBranch name in Merge Before Build

HI

I am using Merge Before Build to merge the code temporarily to merge and trigger the PR. When PR is raised through BitBucket, the variable $targetBranch works perfectly, where as when PR is raised with GitHub, we dont get this value. During the exploration, I could see that $GIT_BRANCH can be used, but its returning origin/origin/, of which having additional origin name. Tried with regular expression in the filed “Branch to merge to” with ${GIT_BRANCH,fullName=false} and also tried with ${GIT_BRANCH,fullName=false} but no luck.

What is the best option to get target branch name from PR raised through GitHub