diff --git a/src/tech/avroid/scm/Git.groovy b/src/tech/avroid/scm/Git.groovy index abd6907..069a95a 100644 --- a/src/tech/avroid/scm/Git.groovy +++ b/src/tech/avroid/scm/Git.groovy @@ -11,6 +11,17 @@ class Git implements Serializable { this.script = script } + * get current Branch name + * @return String - branch name + */ + public String getBranch() { + if (script.env.BRANCH_NAME.startsWith('PR')) { + return "${script.env.CHANGE_BRANCH}" + } + + return "${script.env.BRANCH_NAME}" + } + /** * Method to clone a Git repository * @param args Map - Arguments for cloning