Hi there!
Is there any way to get the original feature branch name within a pipeline that was triggered by a PR build rather than the "PR-#" style BRANCH_NAME?
I've tried things like:
scm checkout
def branch = sh(returnStdout: true, script: 'git rev-parse --abbrev-ref HEAD').trim()
But that doesn't work because its actually on a detached head commit with no branch.
Our Github Organization is currently configured to use:
- Build origin branches
- Build origin PRs (unmerged head)
We also specify "Include branches" so that we only build the "master PR-*" branches.
It seems like I could use "Build origin branches also filed as PRs" and get the correct BRANCH_NAME for free. But if I understand correctly, "Include branches" would become useless and I would no longer be able to configure it to build only the "master" branch and pull request branches.
Anyone have any ideas how I might be able to make this work?
Thanks!
-Logan