Get destination branch on pull request pipelines

I’m trying to trigger pipelines on Github Pull Request events, following this (Introduce the ability to trigger pipelines on GitHub pull request events - CircleCI) and that works. The problem is that pipeline executes a terraform plan against different AWS accounts, depending on whether the destination branch is dev or main. This is causing a lot of headaches because we don’t know how to get the name of the target branch, it doesn’t seem possible.

Anyone here knows how to do it?